Skip to content

Commit 1b04251

Browse files
Fixed PartnerGroup not checking if reminder_schedule needs to be updates, added comments explaining need for the check
1 parent 605f99d commit 1b04251

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

app/models/organization.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ def upcoming
9494
end
9595

9696
before_save do
97+
# To avoid constantly changing the start date of the reminder_schedule, only update the schedule if something has actually
98+
# changed.
9799
if should_update_reminder_schedule
98100
self.reminder_schedule = create_schedule
99101
end

app/models/partner_group.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ class PartnerGroup < ApplicationRecord
2020
has_and_belongs_to_many :item_categories
2121

2222
before_save do
23-
self.reminder_schedule = create_schedule
23+
# To avoid constantly changing the start date of the reminder_schedule, only update the schedule if something has actually
24+
# changed.
25+
if should_update_reminder_schedule
26+
self.reminder_schedule = create_schedule
27+
end
2428
end
2529

2630
validates :name, presence: true, uniqueness: { scope: :organization }

0 commit comments

Comments
 (0)