Skip to content

Commit

Permalink
Put filters back into switch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunicorn committed Nov 13, 2024
1 parent a8fdca1 commit 3507b29
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions app/lib/features/events/providers/event_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,22 +205,23 @@ final eventListSearchedAndFilterProvider = FutureProvider.autoDispose
.family<List<ffi.CalendarEvent>, String?>((ref, spaceId) async {
//Declare filtered event list

final bookmarkedEvents =
await ref.watch(bookmarkedEventListProvider(spaceId).future);
final ongoingEvents =
await ref.watch(allOngoingEventListProvider(spaceId).future);
final upcomingEvents =
await ref.watch(allUpcomingEventListProvider(spaceId).future);
final pastEvents = await ref.watch(allPastEventListProvider(spaceId).future);

final List<ffi.CalendarEvent> filteredEventList =
switch (ref.watch(eventListFilterProvider(spaceId))) {
EventFilters.bookmarked => bookmarkedEvents,
EventFilters.ongoing => ongoingEvents,
EventFilters.upcoming => upcomingEvents,
EventFilters.past => pastEvents,
EventFilters.bookmarked =>
await ref.watch(bookmarkedEventListProvider(spaceId).future),
EventFilters.ongoing =>
await ref.watch(allOngoingEventListProvider(spaceId).future),
EventFilters.upcoming =>
await ref.watch(allUpcomingEventListProvider(spaceId).future),
EventFilters.past =>
await ref.watch(allPastEventListProvider(spaceId).future),
EventFilters.all =>
ongoingEvents.followedBy(upcomingEvents).followedBy(pastEvents).toList(),
(await ref.watch(allOngoingEventListProvider(spaceId).future))
.followedBy(
await ref.watch(allUpcomingEventListProvider(spaceId).future),
)
.followedBy(await ref.watch(allPastEventListProvider(spaceId).future))
.toList(),
};

final priotizeBookmarkedEvents = await priotizeBookmarked(
Expand Down

0 comments on commit 3507b29

Please sign in to comment.