From 460075f4b646d8f248003417b6ebc63bb08d677b Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Sun, 5 Mar 2023 09:06:14 +0100 Subject: [PATCH] Fix: Correct year result calculation --- bicycle.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bicycle.go b/bicycle.go index 0b99b99..913a861 100644 --- a/bicycle.go +++ b/bicycle.go @@ -217,8 +217,7 @@ func api_builder() { year_result.Unit = DISTANCE_UNIT if distances[i].StartTime.Year() == time.Now().Year() { elapsed_days := time.Now().YearDay() - relation := float64(elapsed_days) * 100 / 365 - year_result.Value = roundFloat(year_distance.Value*relation, 2) + year_result.Value = roundFloat(year_distance.Value*365/float64(elapsed_days), 2) } else { year_result = year_distance }