Skip to content

Commit 833787e

Browse files
Merge pull request #15 from topcoder-platform/PM-2097
PM 2097 Fix sort by prize on challenge listing
2 parents 6296e96 + a65d510 commit 833787e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ workflows:
102102
- develop
103103
- feature/top-262-projectid-non-mandatory
104104
- TOP-2364
105+
- PM-2097
105106

106107
- "build-qa":
107108
context: org-global

src/services/ChallengeService.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ const includeReturnFields = {
210210
reviewers: true,
211211
terms: true,
212212
skills: true,
213-
winners: true,
213+
winners: {
214+
orderBy: { placement: "asc" },
215+
},
214216
attachments: true,
215217
track: true,
216218
type: true,
@@ -710,10 +712,14 @@ async function searchChallenges(currentUser, criteria) {
710712
});
711713
}
712714

713-
const sortByProp = criteria.sortBy ? criteria.sortBy : "createdAt";
715+
let sortByProp = criteria.sortBy ? criteria.sortBy : "createdAt";
714716

715717
const sortOrderProp = criteria.sortOrder ? criteria.sortOrder : "desc";
716718

719+
if (sortByProp === "overview.totalPrizes") {
720+
sortByProp = "overviewTotalPrizes";
721+
}
722+
717723
if (criteria.tco) {
718724
prismaFilter.where.AND.push({
719725
events: {

0 commit comments

Comments
 (0)