Skip to content

Commit 357cd2e

Browse files
committed
Avoid creating import notices for vaccination records
We only need to create important notices for vaccination records if the `notify_parents` value is false-y. This avoids queueing unnecessary jobs during imports or when running the database seeds. Jira-Issue: MAV-2309
1 parent b19107a commit 357cd2e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/models/vaccination_record.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ def recalculate_next_dose_delay_triage_date
309309
end
310310

311311
def should_generate_important_notice?
312-
notify_parents_previously_changed?
312+
if id_previously_changed? # new_record? is not available in after_save
313+
!notify_parents # important notices are only generated if this is false
314+
else
315+
notify_parents_previously_changed?
316+
end
313317
end
314318

315319
def generate_important_notice_if_needed

0 commit comments

Comments
 (0)