Skip to content

Commit

Permalink
Small fix to providers
Browse files Browse the repository at this point in the history
  • Loading branch information
vitormpp committed Jul 3, 2024
1 parent fbe3193 commit 82d6052
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 4 additions & 7 deletions uni/lib/model/providers/lazy/exam_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';

import 'package:uni/controller/fetchers/exam_fetcher.dart';
import 'package:uni/controller/local_storage/database/app_exams_database.dart';
import 'package:uni/controller/local_storage/preferences_controller.dart';
import 'package:uni/controller/parsers/parser_exams.dart';
import 'package:uni/model/entities/course_units/course_unit.dart';
import 'package:uni/model/entities/exam.dart';
Expand Down Expand Up @@ -30,24 +29,22 @@ class ExamProvider extends StateProviderNotifier<List<Exam>> {
profile,
session,
profile.courseUnits,
persistentSession:
(await PreferencesController.getPersistentUserInfo()) != null,
);
}

Future<List<Exam>> fetchUserExams(
ParserExams parserExams,
Profile profile,
Session session,
List<CourseUnit> userUcs, {
required bool persistentSession,
}) async {
List<CourseUnit> userUcs,
) async {
final exams = await ExamFetcher(profile.courses, userUcs)
.extractExams(session, parserExams);

exams.sort((exam1, exam2) => exam1.begin.compareTo(exam2.begin));

await AppExamsDatabase().saveIfPersistentSession(exams);
final db = AppExamsDatabase();
await db.saveIfPersistentSession(exams);

return exams;
}
Expand Down
4 changes: 0 additions & 4 deletions uni/lib/model/providers/lazy/lecture_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher.dart';
import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher_api.dart';
import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher_html.dart';
import 'package:uni/controller/local_storage/database/app_lectures_database.dart';
import 'package:uni/controller/local_storage/preferences_controller.dart';
import 'package:uni/model/entities/lecture.dart';
import 'package:uni/model/entities/profile.dart';
import 'package:uni/model/entities/session.dart';
Expand All @@ -25,15 +24,12 @@ class LectureProvider extends StateProviderNotifier<List<Lecture>> {
return fetchUserLectures(
stateProviders.sessionProvider.state!,
stateProviders.profileProvider.state!,
persistentSession:
(await PreferencesController.getPersistentUserInfo()) != null,
);
}

Future<List<Lecture>> fetchUserLectures(
Session session,
Profile profile, {
required bool persistentSession,
ScheduleFetcher? fetcher,
}) async {
final lectures =
Expand Down

0 comments on commit 82d6052

Please sign in to comment.