From 57ed34085324528a88765a51edf6c50cb523b0c4 Mon Sep 17 00:00:00 2001 From: Aliaksei Date: Wed, 2 Oct 2024 18:31:59 +0300 Subject: [PATCH] ref sort by user suggestion --- .../pages/suggestions/suggestions_state.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/presentation/pages/suggestions/suggestions_state.dart b/lib/src/presentation/pages/suggestions/suggestions_state.dart index 5905103..8e5545d 100644 --- a/lib/src/presentation/pages/suggestions/suggestions_state.dart +++ b/lib/src/presentation/pages/suggestions/suggestions_state.dart @@ -138,15 +138,15 @@ extension SortTypeExtension on SortType { SortType.creationDate => (a, b) => b.creationTime.compareTo(a.creationTime), SortType.userSuggestion => (a, b) { - if (a.authorId == i.userId && b.authorId == i.userId) { - return b.upvotesCount.compareTo(a.upvotesCount); - } else if (a.authorId == i.userId) { + if (a.authorId == i.userId) { + if (b.authorId == i.userId) { + return b.upvotesCount.compareTo(a.upvotesCount); + } return -1; } else if (b.authorId == i.userId) { return 1; - } else { - return b.upvotesCount.compareTo(a.upvotesCount); } + return b.upvotesCount.compareTo(a.upvotesCount); } }; }