Skip to content

Commit

Permalink
Fix next step calculation when steps are run out of order
Browse files Browse the repository at this point in the history
- can happen in a hotfix or patch fix scebario
  • Loading branch information
nid90 committed Jan 3, 2024
1 parent 27a5b96 commit 66d0c1f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/libs/queries/release_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Queries::ReleaseSummary::StepsSummary
def self.from_release(release)
attributes = release.release_platform_runs.map do |pr|
pr.steps.map do |step|
step_runs = pr.step_runs_for(step)
step_runs = pr.step_runs_for(step).sequential
started_at = step_runs.first&.scheduled_at
ended_at = step_runs.last&.updated_at
{
Expand Down
2 changes: 1 addition & 1 deletion app/models/commit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def short_sha
end

def step_runs_for(platform_run)
step_runs.where(release_platform_run: platform_run).includes(:step).order(:created_at)
step_runs.where(release_platform_run: platform_run).includes(:step)
end

def applied_at
Expand Down
2 changes: 1 addition & 1 deletion app/models/release_platform_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def running_step?

def last_run_for(step)
return if last_commit.blank?
last_commit.step_runs_for(self).where(step: step).last
last_commit.step_runs_for(self).where(step: step).sequential.last
end

def current_step_number
Expand Down

0 comments on commit 66d0c1f

Please sign in to comment.