Skip to content

Commit

Permalink
Sort grades by date on term details page (#1646)
Browse files Browse the repository at this point in the history
Closes #1643
  • Loading branch information
nilsreichardt authored May 23, 2024
1 parent 1b5b877 commit 7495cab
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class TermDetailsPageController extends ChangeNotifier {
DateFormat('dd.MM.yyyy').format(grade.date.toDateTime)
))
.toList()
..sortByDate(),
);
}).toList();

Expand Down Expand Up @@ -146,3 +147,10 @@ class TermDetailsPageError extends TermDetailsPageState {

const TermDetailsPageError(this.error);
}

extension on List<SavedGradeView> {
/// Sorts the list of grades by date in descending order.
void sortByDate() {
sort((a, b) => b.date.compareTo(a.date));
}
}

0 comments on commit 7495cab

Please sign in to comment.