Skip to content

Commit

Permalink
[MDS-5331] Incidents 400 error (#2560)
Browse files Browse the repository at this point in the history
Only checked do paragraphs if they've been changed on update
  • Loading branch information
matbusby-fw authored Jun 8, 2023
1 parent 8062caf commit 88c647f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def delete(self, mine_guid, mine_incident_guid):
@requires_any_of([EDIT_DO, MINESPACE_PROPONENT])
def put(self, mine_guid, mine_incident_guid):
incident = MineIncident.find_by_mine_incident_guid(mine_incident_guid)
current_do_sub_codes = incident.dangerous_occurrence_subparagraphs
prev_status_code = incident.status_code
if not incident or str(incident.mine_guid) != mine_guid:
raise NotFound("Mine Incident not found")
Expand Down Expand Up @@ -398,7 +399,7 @@ def put(self, mine_guid, mine_incident_guid):
incident.dangerous_occurrence_subparagraphs = []
for id in do_sub_codes:
sub = ComplianceArticle.find_by_compliance_article_id(id)
if not _compliance_article_is_do_subparagraph(sub):
if not _compliance_article_is_do_subparagraph(sub) and sub not in current_do_sub_codes:
raise BadRequest(
'One of the provided compliance articles is not a sub-paragraph of section 1.7.3 (dangerous occurrences)'
)
Expand Down

0 comments on commit 88c647f

Please sign in to comment.