瀏覽代碼

Take timezones into account. I would get +100% outcomes. This is fixed now.

Sacha Ligthert 3 年之前
父節點
當前提交
961d4563e7
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      tp.go

+ 6 - 1
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.