NIAEFEUP / uni

Mobile app designed to help students of the University of Porto to manage their academic life.
GNU General Public License v3.0
50 stars 18 forks source link

feat: added mapper function to LazyConsumer #1374

Closed HenriqueSFernandes closed 3 weeks ago

HenriqueSFernandes commented 3 weeks ago

Closes #1238

  1. Changed LazyConsumer to use a mapper function that, by default, returns the value itself.
  2. Implemented a mapper function on schedule_card to filter out classes that have already ended.
Before this fix, if there were no more classes scheduled, but the student had a class that day (thus the schedule wasn't empty), the schedule_card did not show any content. Now, it shows "No classes to present": Before After
Screenshot_2024-10-31-01-37-18-246_pt up fe ni uni Screenshot_2024-10-31-01-31-28-409_pt up fe ni uni

To test, change the lecture_provider to return a list with a class on the current day that has already ended, for example:

Future<List<Lecture>> fetchUserLectures(
  Session session, {
  ScheduleFetcher? fetcher,
}) async {
  final lectures = await getLecturesFromFetcherOrElse(fetcher, session);

  final db = AppLecturesDatabase();
  await db.saveIfPersistentSession(lectures);

  return [
    Lecture(
      'TEST',
      'TP',
      DateTime.parse('2024-10-31 00:30'),
      DateTime.parse('2024-10-31 01:00'),
      'B003',
      'PNFRCD',
      '1LEIC01',
      1,
    ),
  ];
}

Review checklist

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 12%. Comparing base (4259069) to head (044f823). Report is 9 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1374 +/- ## ======================================= + Coverage 12% 12% +1% ======================================= Files 266 266 Lines 7201 7201 ======================================= + Hits 803 806 +3 + Misses 6398 6395 -3 ```
limwa commented 3 weeks ago

@HenriqueSFernandes you can merge the PR if you want to