Skip to content

Commit

Permalink
Fix testing_progress for staging projects
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Nov 23, 2018
1 parent 111deba commit b784eae
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/api/app/helpers/webui/staging/workflow_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,8 @@ def review_progress(staging_project)
end

def testing_progress(staging_project)
notdone = allchecks = 0

# Note: The status_reports are defined via a has many through relation. Since within the
# status report context the bs request relation is polymorphic, we have to call
# includes with the polymorphic name ('checkable').
staging_project.status_reports.includes(:checkable).each do |report|
notdone += report.checks.where(state: 'pending').size
allchecks += report.checks.size + report.missing_checks.size
end
notdone = staging_project.checks.pending.size
allchecks = staging_project.checks.size + staging_project.missing_checks.size

return 100 if allchecks == 0
100 - notdone * 100 / allchecks
Expand Down

0 comments on commit b784eae

Please sign in to comment.