Skip to content

Commit

Permalink
Fix data migration for scheduled release to release connection properly
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Mar 7, 2024
1 parent d7e1e2f commit 8fdc465
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ def up
next if scheduled.blank?

scheduled.each do |scheduled_release|
# skip if the scheduled release is not automatic
next unless scheduled_release.is_automatic?

# find a release within a 10 minute window around the scheduled release schedule time
target_date = scheduled_release.scheduled_at
release = train.releases.where("scheduled_at >= ? AND scheduled_at <= ?", target_date - 10.minutes, target_date + 10.minutes).first
release = train.releases.where("scheduled_at >= ? AND scheduled_at <= ?", target_date - 10.minutes, target_date + 10.minutes).where(is_automatic: true).first

# update the scheduled release if a release was found
next if release.blank?
Expand Down

0 comments on commit 8fdc465

Please sign in to comment.