Skip to content

Conversation

@jmgasper
Copy link
Contributor

@jmgasper jmgasper commented Nov 3, 2025

No description provided.

@jmgasper jmgasper merged commit ef933ae into develop Nov 3, 2025
4 checks passed
cb."challengeId" AS challenge_id,
MAX(cb."billingAccountId") FILTER (WHERE cb."billingAccountId" IS NOT NULL) AS billing_account_id
FROM challenges."ChallengeBilling" cb
WHERE cb."billingAccountId" = '80000062'
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The filter condition cb."billingAccountId" = '80000062' is hardcoded. Consider parameterizing this value to improve maintainability and flexibility of the query.

FROM challenges."Challenge" c
JOIN bill b
ON b.challenge_id = c.id
WHERE c."createdAt" >= now() - interval '4 months'
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The condition c."createdAt" >= now() - interval '4 months' is repeated in the main query and the base_challenges CTE. Ensure this logic is consistent across all usages or consider centralizing this logic to avoid potential discrepancies.

bc."registrationStartDate" AS registration_start_date,
CASE
WHEN bc.status = 'COMPLETED'
AND bc."createdAt" > '2025-01-01T00:00:00Z'
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The condition bc."createdAt" > '2025-01-01T00:00:00Z' is repeated multiple times. Consider defining this as a constant or parameter to enhance maintainability and reduce the risk of errors if the date needs to be updated.

WHERE p.winnings_id = w.winning_id
) ps ON TRUE
WHERE r."challengeId" = bc.id
AND bc."createdAt" > '2025-01-01T00:00:00Z'
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The condition bc.status IN ('ACTIVE', 'COMPLETED') is used multiple times. Consider defining this as a constant or parameter to improve maintainability and ensure consistency across the query.

AND bc.status = 'COMPLETED'
AND bc."createdAt" > '2025-01-01T00:00:00Z'
) cp ON TRUE
WHERE bc.billing_account_id = '80000062'
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The condition bc.billing_account_id = '80000062' is hardcoded. Consider parameterizing this value to improve maintainability and flexibility of the query.

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