Skip to content

Commit

Permalink
Fix the problem of not recognizing summer semester
Browse files Browse the repository at this point in the history
  • Loading branch information
nohackjustnoobb committed Jun 13, 2024
1 parent e652ab6 commit 927a832
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/src/common/services/moodle_managers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,17 @@ class MoodleCourseManager with ChangeNotifier {
for (final course in sortedCourses) {
var groups =
RegExp(r'^(.*)_(\w{0,3})_(\d{4})$').firstMatch(course.idnumber);
final sem = int.tryParse(groups?.group(2)?[0] ?? "0");

final year = int.tryParse(groups?.group(3) ?? "0");

String? semString = groups?.group(2)?[0];
// Check if it is summer semester
if (semString != null && semString.toLowerCase() == "s") {
semString = "3";
}

final sem = int.tryParse(semString ?? "0");

if (year != null && sem != null) {
coursesYearAndSemester[course.id] = [year, sem];

Expand Down

0 comments on commit 927a832

Please sign in to comment.