Skip to content

Commit

Permalink
ref sorting by user's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
trullse committed Oct 3, 2024
1 parent 57ed340 commit fe3ca9a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/src/presentation/pages/suggestions/suggestions_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,13 @@ extension SortTypeExtension on SortType {
SortType.creationDate => (a, b) =>
b.creationTime.compareTo(a.creationTime),
SortType.userSuggestion => (a, b) {
if (a.authorId == i.userId) {
if (b.authorId == i.userId) {
return b.upvotesCount.compareTo(a.upvotesCount);
}
if (a.authorId == i.userId && b.authorId != i.userId) {
return -1;
} else if (b.authorId == i.userId) {
}
if (a.authorId != i.userId && b.authorId == i.userId) {
return 1;
}

return b.upvotesCount.compareTo(a.upvotesCount);
}
};
Expand Down

0 comments on commit fe3ca9a

Please sign in to comment.