Skip to content

Commit

Permalink
feat: semester progress tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMuuo committed Jul 19, 2024
1 parent 6267ea4 commit 0f5e222
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/exports/barrel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export 'package:flutter_pdfview/flutter_pdfview.dart';
export 'package:academia/widgets/info_card.dart';
export 'package:cached_network_image/cached_network_image.dart';
export 'package:academia/constants/tools.dart';
export 'package:academia/tools/birthday/birthday_page.dart';
export 'package:academia/widgets/tool_card.dart';
export 'package:awesome_notifications/awesome_notifications.dart';
export 'package:academia/tools/todo/todo.dart';
Expand Down
16 changes: 10 additions & 6 deletions lib/tools/events/controllers/events_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ class EventsController extends GetxController {
currentSemester.value = Semester.fromJson(json.decode(semData));
return;
}
// fetch the current semester
final result = await semesterService.fetchCurrentSemester();
result.fold((l) {}, (r) {
prefs.setString("semester", json.encode(r.toJson()));
currentSemester.value = r;
});

if (semData == null ||
currentSemester.value!.endDate.isBefore(DateTime.now())) {
// fetch the current semester
final result = await semesterService.fetchCurrentSemester();
result.fold((l) {}, (r) {
prefs.setString("semester", json.encode(r.toJson()));
currentSemester.value = r;
});
}
}
}

0 comments on commit 0f5e222

Please sign in to comment.