Skip to content

Conversation

@jmgasper
Copy link
Collaborator

@jmgasper jmgasper commented Nov 2, 2025

No description provided.

@jmgasper jmgasper merged commit e53ba15 into master Nov 2, 2025
6 checks passed
`,
);
cteFragments.push(
Prisma.sql`
Copy link

Choose a reason for hiding this comment

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

[⚠️ performance]
The use of COUNT(*)::bigint and SUM(...)::bigint is consistent with the previous implementation, but ensure that the casting to bigint is necessary for the application logic. If the counts are expected to be within the range of integer, this casting might be unnecessary and could be optimized.

);
cteFragments.push(
Prisma.sql`
incomplete_reviews AS (
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The DISTINCT ON clause is used here to select unique resourceId entries. Ensure that this approach aligns with the intended logic, as DISTINCT ON can sometimes lead to unexpected results if the ordering is not carefully considered.


const reviewTotalsJoin = adminUser
? Prisma.sql`
LEFT JOIN LATERAL (
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The conditional logic for adminUser results in different SQL joins. Verify that the logic correctly handles all cases, especially when transitioning between admin and non-admin users, to ensure that the correct data is retrieved.


const incompleteReviewsJoin = adminUser
? Prisma.sql`
LEFT JOIN LATERAL (
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The logic for determining hasIncompleteReviews and incompletePhaseName is duplicated for admin and non-admin users. Consider refactoring to reduce redundancy and improve maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants