Skip to content

Commit

Permalink
fix completeness calculate
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Sep 29, 2019
1 parent 067826a commit 912d305
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func updateMilestoneTotalNum(e Engine, milestoneID int64) (err error) {
return
}

_, err = e.Exec("UPDATE `milestone` SET completeness=100*num_closed_issues/(num_issues+1-sign(num_issues)) WHERE id=?",
_, err = e.Exec("UPDATE `milestone` SET completeness=100*num_closed_issues/(num_issues+1-(CASE WHEN num_issues > 0 THEN 1 ELSE 0 END)) WHERE id=?",
milestoneID,
)

Expand All @@ -335,7 +335,7 @@ func updateMilestoneClosedNum(e Engine, milestoneID int64) (err error) {
return
}

_, err = e.Exec("UPDATE `milestone` SET completeness=100*num_closed_issues/(num_issues+1-sign(num_issues)) WHERE id=?",
_, err = e.Exec("UPDATE `milestone` SET completeness=100*num_closed_issues/(num_issues+1-(CASE WHEN num_issues > 0 THEN 1 ELSE 0 END)) WHERE id=?",
milestoneID,
)
return
Expand Down

0 comments on commit 912d305

Please sign in to comment.