From 5b2568df41e1df265d79d6275de8837089e5c807 Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Mon, 18 Nov 2024 18:41:00 +0000 Subject: [PATCH] refactor: disable past meals filtering temporarily --- .../database/app_restaurant_database.dart | 6 +++++- .../model/providers/lazy/restaurant_provider.dart | 15 +++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart b/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart index 70c15204f..045c19fed 100644 --- a/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart +++ b/packages/uni_app/lib/controller/local_storage/database/app_restaurant_database.dart @@ -70,7 +70,11 @@ class RestaurantDatabase extends AppDatabase> { } }); - return filterPastMeals(restaurants); + // TODO: reimplement the filter. + + // return filterPastMeals(restaurants); + + return restaurants; } Future> getRestaurantMeals( diff --git a/packages/uni_app/lib/model/providers/lazy/restaurant_provider.dart b/packages/uni_app/lib/model/providers/lazy/restaurant_provider.dart index 258633ae2..a4b70a388 100644 --- a/packages/uni_app/lib/model/providers/lazy/restaurant_provider.dart +++ b/packages/uni_app/lib/model/providers/lazy/restaurant_provider.dart @@ -9,20 +9,13 @@ import 'package:uni/model/providers/state_providers.dart'; class RestaurantProvider extends StateProviderNotifier> { RestaurantProvider() : super(cacheDuration: const Duration(days: 1)); - // @override - // Future> loadFromStorage( - // StateProviders stateProviders, - // ) async { - // final restaurantDb = RestaurantDatabase(); - // final restaurants = await restaurantDb.getRestaurants(); - // return restaurants; - // } - @override Future> loadFromStorage( StateProviders stateProviders, ) async { - return loadFromRemote(stateProviders); + final restaurantDb = RestaurantDatabase(); + final restaurants = await restaurantDb.getRestaurants(); + return restaurants; } @override @@ -33,6 +26,8 @@ class RestaurantProvider extends StateProviderNotifier> { final db = RestaurantDatabase(); unawaited(db.saveIfPersistentSession(restaurants)); + // TODO: enable past meals filtering after SASUP publishes the new menus (ALSO CHANGE IN THE STORAGE DATABASE!!!!). + // return filterPastMeals(restaurants); return restaurants; }