From 961d4563e779dfadb6934be4b526abafc6d8ba24 Mon Sep 17 00:00:00 2001 From: Sacha Ligthert Date: Tue, 27 Dec 2022 00:41:56 +0100 Subject: [PATCH] Take timezones into account. I would get +100% outcomes. This is fixed now. --- tp.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tp.go b/tp.go index 5838efa..edd4ea7 100644 --- a/tp.go +++ b/tp.go @@ -121,7 +121,12 @@ func renderPercentage(percentage float64) string { // Get the percentages between two float64s func calcPercentageFloat64(full float64, part float64) float64 { - return part / (full / 100) + var percentage float64 + percentage = part / (full / 100) + if percentage >= 100 { + percentage = percentage - 100 + } + return percentage } // Get the start of the year.