Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/api/my-review/myReview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,13 @@ export class MyReviewService {
break;
}

const fallbackOrderFragments = [
Prisma.sql`c."createdAt" DESC NULLS LAST`,
Prisma.sql`c.name ASC`,
];
const fallbackOrderFragments = shouldFetchPastChallenges
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The conditional assignment of fallbackOrderFragments based on shouldFetchPastChallenges is correct, but consider extracting this logic into a separate function for better maintainability and readability. This will make it easier to test and modify in the future.

? [
Prisma.sql`c."endDate" DESC NULLS LAST`,
Prisma.sql`c."createdAt" DESC NULLS LAST`,
Prisma.sql`c.name ASC`,
]
: [Prisma.sql`c."createdAt" DESC NULLS LAST`, Prisma.sql`c.name ASC`];
const orderFragments = sortFragments.length
? [...sortFragments, ...fallbackOrderFragments]
: fallbackOrderFragments;
Expand Down