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
15 changes: 7 additions & 8 deletions src/api/my-review/myReview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export class MyReviewService {
cp_incomplete.name ASC
LIMIT 1
) AS "incompletePhaseName"
) deliverable_reviews ON TRUE
) deliverable_reviews ON r.id IS NOT NULL
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Changing the join condition from ON TRUE to ON r.id IS NOT NULL may alter the behavior of the query, especially if r.id can be NULL. Ensure that this change aligns with the intended logic and does not inadvertently exclude rows that should be included.

`,
Prisma.sql`
LEFT JOIN LATERAL (
Expand All @@ -301,7 +301,7 @@ export class MyReviewService {
WHERE rv_pending."resourceId" = r.id
AND apr.id IS NULL
) AS "hasPendingAppealResponses"
) pending_appeals ON TRUE
) pending_appeals ON r.id IS NOT NULL
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Similar to the previous change, updating the join condition from ON TRUE to ON r.id IS NOT NULL could impact the query results. Verify that this modification is intentional and that it correctly reflects the desired logic.

`,
Prisma.sql`
LEFT JOIN LATERAL (
Expand All @@ -322,12 +322,11 @@ export class MyReviewService {
Prisma.sql`
LEFT JOIN LATERAL (
SELECT
EXISTS (
SELECT 1
FROM challenges."ChallengeReviewer" cr
WHERE cr."challengeId" = c.id
AND cr."aiWorkflowId" is not NULL
) AS "hasAIReview"
TRUE AS "hasAIReview"
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Replacing the EXISTS check with TRUE AS "hasAIReview" changes the logic to always return TRUE, regardless of whether there is an AI review. This could lead to incorrect data representation. Confirm that this change is intended and that it does not misrepresent the presence of AI reviews.

FROM challenges."ChallengeReviewer" cr
WHERE cr."challengeId" = c.id
AND cr."aiWorkflowId" IS NOT NULL
LIMIT 1
) cr ON TRUE
`,
];
Expand Down