Skip to content

Commit

Permalink
Fix course evaluation bug and set appVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierPaquet-Rapold committed Mar 12, 2024
1 parent a40edc4 commit 56a2a38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/core/managers/course_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,11 @@ class CourseRepository {
/// Get the evaluation for a course or null if not found.
CourseReview? _getReviewForCourse(
Course course, Map<String, List<CourseReview>> reviews) {
// Todo: changer pour firstWhereOrNull après update de Collection
final review = reviews[course.session]?.where((element) =>
element.acronym == course.acronym && element.group == course.group);
return review?.length == 1 ? review?.first : null;
element.acronym == course.acronym && element.group == course.group);
return review?.isNotEmpty ?? false
? review?.first
: null;
}
}
3 changes: 2 additions & 1 deletion lib/core/viewmodels/more_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class MoreViewModel extends FutureViewModel {
Future futureToRun() async {
try {
setBusy(true);
await PackageInfo.fromPlatform();
final packageInfo = await PackageInfo.fromPlatform();
_appVersion = packageInfo.version;
} catch (error) {
onError(error);
} finally {
Expand Down

0 comments on commit 56a2a38

Please sign in to comment.