Skip to content

Commit 8a69493

Browse files
authored
Merge pull request #145 from topcoder-platform/performance
Additional tweak for past-challenges on my-reviews for large / admin …
2 parents b9c3b5f + 0c56c08 commit 8a69493

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/api/my-review/myReview.service.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,13 @@ export class MyReviewService {
533533
break;
534534
}
535535

536-
const fallbackOrderFragments = [
537-
Prisma.sql`c."createdAt" DESC NULLS LAST`,
538-
Prisma.sql`c.name ASC`,
539-
];
536+
const fallbackOrderFragments = shouldFetchPastChallenges
537+
? [
538+
Prisma.sql`c."endDate" DESC NULLS LAST`,
539+
Prisma.sql`c."createdAt" DESC NULLS LAST`,
540+
Prisma.sql`c.name ASC`,
541+
]
542+
: [Prisma.sql`c."createdAt" DESC NULLS LAST`, Prisma.sql`c.name ASC`];
540543
const orderFragments = sortFragments.length
541544
? [...sortFragments, ...fallbackOrderFragments]
542545
: fallbackOrderFragments;

0 commit comments

Comments
 (0)