Skip to content

Commit c1b04da

Browse files
committed
Bugfix: All scorable habits being skipped scoring issue. Bumped version.
1 parent b5bf6d8 commit c1b04da

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

harsh.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func main() {
5555
Name: "Harsh",
5656
Usage: "habit tracking for geeks",
5757
Description: "A simple, minimalist CLI for tracking and understanding habits.",
58-
Version: "0.8.19",
58+
Version: "0.8.20",
5959
Commands: []*cli.Command{
6060
{
6161
Name: "ask",
@@ -468,7 +468,11 @@ func score(d civil.Date, habits []Habit, entries Entries) float64 {
468468
}
469469
}
470470
}
471-
score := (scored / (scorableHabits - skipped)) * 100
471+
472+
score := 100.0 // deal with scorable habits - skipped = 0 causing divide by zero issue
473+
if scorableHabits-skipped != 0 {
474+
score = (scored / (scorableHabits - skipped)) * 100
475+
}
472476
return score
473477
}
474478

0 commit comments

Comments
 (0)