From e75a0765b49089cc4b194fe4e7ed6810f28c1f37 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 13 Sep 2024 22:50:08 +0200 Subject: [PATCH] Reverse the days for the lookup database so the newer entries are being suggested --- lib/storage/storage.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/storage/storage.dart b/lib/storage/storage.dart index e5c989c..ac4598b 100644 --- a/lib/storage/storage.dart +++ b/lib/storage/storage.dart @@ -139,11 +139,11 @@ class FoodStorage { Future buildFoodLookupDatabase() async { // get a list of dates of the last 365 days var dates = List.generate(365, (idx) { - var pastDay = Duration(days: idx); - return DateTime.now().subtract(pastDay); + var durationToPast = Duration(days: idx); + return DateTime.now().subtract(durationToPast); }); - for (var date in dates) { + for (var date in dates.reversed) { addFoodEntryToLookupDatabaseFor(date); } }