Skip to content

Commit 3993392

Browse files
feat: un-prescribe when detection_control_status is OFFICIAL_REPORT_DRAWN_UP
1 parent ef0f5f9 commit 3993392

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/models/detection_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ class DetectionData(TimestampedModelMixin, UuidModelMixin, DeletableModelMixin):
7979
def set_detection_control_status(self, value: DetectionControlStatus):
8080
self.detection_control_status = value
8181

82+
# un-prescribe when detection_control_status is OFFICIAL_REPORT_DRAWN_UP
83+
if value == DetectionControlStatus.OFFICIAL_REPORT_DRAWN_UP:
84+
self.detection_prescription_status = (
85+
DetectionPrescriptionStatus.NOT_PRESCRIBED
86+
)
87+
8288
if (
8389
value != DetectionControlStatus.NOT_CONTROLLED
8490
and self.detection_validation_status

core/serializers/detection_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def update(self, instance: DetectionData, validated_data):
155155
or instance.detection_control_status
156156
)
157157

158-
# allow update official_report_date only if detection_control_status isOFFICIAL_REPORT_DRAWN_UP
158+
# allow update official_report_date only if detection_control_status is OFFICIAL_REPORT_DRAWN_UP
159159
if detection_control_status != DetectionControlStatus.OFFICIAL_REPORT_DRAWN_UP:
160160
validated_data.pop("official_report_date", None)
161161

0 commit comments

Comments
 (0)