Reverse the days for the lookup database so the newer entries are being suggested

This commit is contained in:
Marco 2024-09-13 22:50:08 +02:00
parent 9179cff38e
commit e75a0765b4

View File

@ -139,11 +139,11 @@ class FoodStorage {
Future<void> buildFoodLookupDatabase() async { Future<void> buildFoodLookupDatabase() async {
// get a list of dates of the last 365 days // get a list of dates of the last 365 days
var dates = List<DateTime>.generate(365, (idx) { var dates = List<DateTime>.generate(365, (idx) {
var pastDay = Duration(days: idx); var durationToPast = Duration(days: idx);
return DateTime.now().subtract(pastDay); return DateTime.now().subtract(durationToPast);
}); });
for (var date in dates) { for (var date in dates.reversed) {
addFoodEntryToLookupDatabaseFor(date); addFoodEntryToLookupDatabaseFor(date);
} }
} }