Skip to content

Comments

Start / end dates to weekly member participation report#47

Merged
jmgasper merged 2 commits intomasterfrom
develop
Feb 5, 2026
Merged

Start / end dates to weekly member participation report#47
jmgasper merged 2 commits intomasterfrom
develop

Conversation

@jmgasper
Copy link
Collaborator

@jmgasper jmgasper commented Feb 5, 2026

No description provided.

@jmgasper jmgasper merged commit 7fb676c into master Feb 5, 2026
6 checks passed
SELECT
(DATE_TRUNC('week', CURRENT_DATE) - INTERVAL '4 weeks') AS window_start,
(DATE_TRUNC('week', CURRENT_DATE) + INTERVAL '1 week') AS window_end
NULLIF($1, '')::timestamptz AS start_date,
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Casting directly from NULLIF($1, '') to timestamptz might lead to runtime errors if the input is not a valid timestamp. Consider validating the input before casting.

(DATE_TRUNC('week', CURRENT_DATE) - INTERVAL '4 weeks') AS window_start,
(DATE_TRUNC('week', CURRENT_DATE) + INTERVAL '1 week') AS window_end
NULLIF($1, '')::timestamptz AS start_date,
NULLIF($2, '')::timestamptz AS end_date
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
Casting directly from NULLIF($2, '') to timestamptz might lead to runtime errors if the input is not a valid timestamp. Consider validating the input before casting.

ON proj.id::text = NULLIF(TRIM(c."projectId"::text), '')
LEFT JOIN "billing-accounts"."BillingAccount" project_ba
ON project_ba.id = proj."billingAccountId"
ON project_ba.id::text = NULLIF(TRIM(proj."billingAccountId"::text), '')
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
Using NULLIF(TRIM(proj."billingAccountId"::text), '') might lead to unexpected behavior if proj."billingAccountId" is NULL. Consider handling NULL values explicitly.

getWeeklyMemberParticipation(
@Query() query: WeeklyMemberParticipationQueryDto,
) {
const { startDate, endDate } = query;
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider validating startDate and endDate to ensure they are valid dates and that startDate is not after endDate. This will prevent potential errors or unexpected behavior in the report generation.

"challenge_stats.count_distinct_registrant": string | number;
"challenge_stats.count_distinct_submitter": string | number;
}>(query);
}>(query, [startDate ?? null, endDate ?? null]);
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The use of startDate ?? null and endDate ?? null as query parameters is potentially problematic if the SQL query expects specific date formats. Ensure that the SQL query and database can handle null values appropriately, or consider validating and formatting the dates before passing them to the query.

async getMemberPaymentAccrual(startDate?: string, endDate?: string) {
const query = this.sql.load("reports/topcoder/member-payment-accrual.sql");
const rows = await this.db.query<MemberPaymentAccrualRow>(query, [
startDate ?? 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 method, ensure that startDate ?? null and endDate ?? null are compatible with the SQL query and database expectations. If the query cannot handle null values, this could lead to unexpected results or errors.

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.

1 participant