Skip to content

Commit

Permalink
Keep match events even if we don't know why the match was closed
Browse files Browse the repository at this point in the history
  • Loading branch information
eanders committed Oct 17, 2024
1 parent 701d9dd commit 716d21b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/warehouse/referral_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def self.sync_match_referrals!
reason = match.unsuccessful_reason
unsuccessful_decision = match.unsuccessful_decision
closed_timestamp = unsuccessful_decision&.updated_at || match.updated_at
if reason.present? && reason.referral_result.present?
# If we have a reason, the match was closed, we may not know the result,
# but we should still capture the event
if reason.present?
if event.referral_result != reason.referral_result
event.update(
event: match.sub_program.event,
Expand All @@ -76,6 +78,8 @@ def self.sync_match_referrals!
)
end
else
# If we don't know why the match was closed (no reason), just remove the event
# This is an unexpected situation
event.destroy
end
end
Expand Down

0 comments on commit 716d21b

Please sign in to comment.