Skip to content

Commit

Permalink
fix: test-dashboard radar divided by zero (#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfwn authored Oct 22, 2021
1 parent 89fa488 commit 85a83eb
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func (q *Q) calcMtPlanScore(ctx context.Context, h *gshelper.GSHelper) float64 {
numCaseTotal += plan.RelsCount.Total
}

if numCaseTotal == 0 {
return 0
}
score := float64(numCasePassed) / float64(numCaseTotal) * float64(numCaseExecuted) / float64(numCaseTotal) * 100
return score
}
Expand Down Expand Up @@ -205,6 +208,9 @@ func (q *Q) calcBugReopenRate(ctx context.Context, h *gshelper.GSHelper) float64
if err != nil {
panic(err)
}
if totalCount == 0 {
return 0
}
score := float64(reopenCount) / float64(totalCount) * 100
return score
}
Expand Down

0 comments on commit 85a83eb

Please sign in to comment.