diff --git a/backend/src/v1/staging_complaint/staging_complaint.service.ts b/backend/src/v1/staging_complaint/staging_complaint.service.ts index ac04b89bd..94512355d 100644 --- a/backend/src/v1/staging_complaint/staging_complaint.service.ts +++ b/backend/src/v1/staging_complaint/staging_complaint.service.ts @@ -102,8 +102,14 @@ export class StagingComplaintService { // Given two WebEOCComplaint objects, compare them and return true if they're the same. This function // ignores some attributes (specifically the back_number_of* attributes) _compareWebEOCComplaints = (complaint1: WebEOCComplaint, complaint2: WebEOCComplaint): boolean => { - // Attributes to ignore - const attributesToIgnore = ["back_number_of_days", "back_number_of_hours", "back_number_of_minutes", "entrydate"]; + // Attributes to ignore, if these are changed we don't consider it an edit + const attributesToIgnore = [ + "back_number_of_days", + "back_number_of_hours", + "back_number_of_minutes", + "entrydate", + "status", + ]; // Omit the attributes to ignore const complaint1Filtered = omit(complaint1, attributesToIgnore); diff --git a/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql b/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql index e26f626a3..b4b3f5e34 100644 --- a/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql +++ b/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql @@ -251,13 +251,6 @@ BEGIN WHERE complaint_identifier = _complaint_identifier; update_edit_ind = true; end if; - - if (_edit_complaint_status_code <> current_complaint_record.complaint_status_code) then - UPDATE complaint - SET complaint_status_code = _edit_complaint_status_code - WHERE complaint_identifier = _complaint_identifier; - update_edit_ind = true; - end if; -- the update caused an edit, set the audit fields if (update_edit_ind) then diff --git a/migrations/migrations/R__update-insert-complaint-from-staging.sql b/migrations/migrations/R__update-insert-complaint-from-staging.sql index 0b4e8f389..f4a052918 100644 --- a/migrations/migrations/R__update-insert-complaint-from-staging.sql +++ b/migrations/migrations/R__update-insert-complaint-from-staging.sql @@ -342,7 +342,7 @@ OR REPLACE FUNCTION public.insert_complaint_from_staging (_complaint_identifier IF _violation_code = 'WASTE' OR _violation_code = 'PESTICDE' THEN UPDATE PUBLIC.complaint - SET owned_by_agency_code = 'EPO' + SET owned_by_agency_code = 'EPO', complaint_status_code = 'OPEN' WHERE complaint_identifier = _complaint_identifier; END IF;