From 558ad030c799dc213505b3025f2a7e160ef7ec63 Mon Sep 17 00:00:00 2001 From: 98spag Date: Sun, 14 May 2023 09:27:23 +0200 Subject: [PATCH] bugfix: adjust timestamp / 1000 --- lib/android/config/statistics.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/android/config/statistics.dart b/lib/android/config/statistics.dart index a5e0fbf..bb0286b 100644 --- a/lib/android/config/statistics.dart +++ b/lib/android/config/statistics.dart @@ -19,7 +19,8 @@ class StatisticsService { // Hive.deleteFromDisk(); Box box = Hive.box(boxName); DateTime dateTime = DateTime.now(); - int timestamp = dateTime.millisecondsSinceEpoch.toInt(); + int timestamp = dateTime.millisecondsSinceEpoch.toInt() ~/ 1000; + print(timestamp); Map>? valueMap = box.get(timestamp); valueMap ??= { "FRÜHSTÜCK": [], @@ -38,7 +39,7 @@ class StatisticsService { num getAllCaloriesByTimestamp(DateTime date){ Box box = Hive.box(boxName); - int timestamp = date.millisecondsSinceEpoch.toInt(); + int timestamp = date.millisecondsSinceEpoch.toInt() ~/ 1000; Map>? valueMap = box.get(timestamp); if(valueMap == null){ return 0; @@ -55,9 +56,9 @@ class StatisticsService { return sum; } - num getCaloriesByTimestampAndMealType(DateTime timestamp, String mealType){ + num getCaloriesByTimestampAndMealType(DateTime date, String mealType){ Box box = Hive.box(boxName); - + int timestamp = date.millisecondsSinceEpoch.toInt() ~/ 1000; Map>? valueMap = box.get(timestamp); if(valueMap == null){ return 0;