Skip to content

Commit 891a7c4

Browse files
committed
Ensure NotifyLogEntry is deleted in testing
This makes a small change to the endpoint to delete teams using the testing API to ensure any notify log entries attached to the team's consent forms get deleted.
1 parent 75a8e43 commit 891a7c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/controllers/api/testing/teams_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def destroy
2626
log_destroy(VaccinationRecord.where(session: sessions))
2727

2828
patient_ids = team.patients.pluck(:id)
29+
consent_form_ids = team.consent_forms.pluck(:id)
2930

3031
log_destroy(PatientSession.where(session: sessions))
3132

@@ -38,6 +39,7 @@ def destroy
3839
# In local dev we can end up with NotifyLogEntries without a patient
3940
log_destroy(NotifyLogEntry.where(patient_id: nil))
4041
log_destroy(NotifyLogEntry.where(patient_id: patient_ids))
42+
log_destroy(NotifyLogEntry.where(consent_form_id: consent_form_ids))
4143
log_destroy(PatientChangeset.where(patient_id: patient_ids))
4244
log_destroy(PatientSession.where(patient_id: patient_ids))
4345
log_destroy(PatientSpecificDirection.where(patient_id: patient_ids))
@@ -48,10 +50,10 @@ def destroy
4850
log_destroy(SchoolMoveLogEntry.where(patient_id: patient_ids))
4951
log_destroy(VaccinationRecord.where(patient_id: patient_ids))
5052

53+
log_destroy(ConsentForm.where(id: consent_form_ids))
5154
log_destroy(SessionDate.where(session: sessions))
5255

5356
log_destroy(ArchiveReason.where(team:))
54-
log_destroy(ConsentForm.where(team:))
5557
log_destroy(Consent.where(team:))
5658
log_destroy(Triage.where(team:))
5759

0 commit comments

Comments
 (0)