From 54276b73eacfab6a5d6b899bd638f6cfe9499b80 Mon Sep 17 00:00:00 2001 From: Flu0r1ne Date: Sun, 5 Sep 2021 13:39:34 -0500 Subject: Refactor with scoring object --- cmd/planr/sub/cli.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/planr/sub/cli.go') diff --git a/cmd/planr/sub/cli.go b/cmd/planr/sub/cli.go index 3c58f4e..e6f2256 100644 --- a/cmd/planr/sub/cli.go +++ b/cmd/planr/sub/cli.go @@ -107,16 +107,16 @@ func tcPprint(tr planr.TestResult) { fmt.Println() } -func printResults(passed, tc_total int, earned, points_total float64) { +func printScoring(score planr.Scoring) { col_title.Println("Final Results:") - pprintLabeled("passed", fmt.Sprintf("%d/%d", passed, tc_total)); + pprintLabeled("passed", fmt.Sprintf("%d/%d", score.Passed, score.Total)); - percent := earned / points_total * 100 + percent := score.EarnedPoints / score.TotalPoints * 100 - if points_total != 0 { + if score.TotalPoints != 0 { pprintLabeled("score", fmt.Sprintf( - "%.2f/%.2f ~= %.1f%%", earned, points_total, percent, + "%.2f/%.2f ~= %.1f%%", score.EarnedPoints, score.TotalPoints, percent, )); } } -- cgit v1.2.3