Skip to content

Commit

Permalink
Fix adoption rate chart to get the correct staged rollout for a day
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Nov 21, 2023
1 parent df51c51 commit 189ff5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/deployment_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ def staged_rollout_events
end
end

def rollout_percentage_at(ts)
def rollout_percentage_at(day)
return 100.0 unless staged_rollout
last_event = staged_rollout
.passports
.where(reason: [:started, :increased, :fully_released])
.where("event_timestamp < ?", ts)
.where("DATE_TRUNC('day', event_timestamp) <= ?", day)
.order(:event_timestamp)
.last
return 0.0 unless last_event
Expand Down

0 comments on commit 189ff5e

Please sign in to comment.