-
Notifications
You must be signed in to change notification settings - Fork 0
Prod - SFDC fixes #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,17 +34,17 @@ latest_status AS ( | |
| ) | ||
| SELECT | ||
| fp.billing_account AS "billingAccountId", | ||
| TO_CHAR(DATE_TRUNC('month', fp.created_at), 'YYYY-MM') AS "month", | ||
| TO_CHAR(DATE_TRUNC('month', fp.created_at AT TIME ZONE 'America/New_York'), 'YYYY-MM') AS "month", | ||
| COALESCE(SUM(fp.challenge_fee), 0) AS "totalFees", | ||
| COALESCE(SUM(fp.total_amount), 0) AS "totalMemberPayments", | ||
| COUNT(fp.payment_id) AS "paymentCount", | ||
| MIN(fp.created_at)::date AS "earliestPaymentDate", | ||
| MAX(fp.created_at)::date AS "latestPaymentDate", | ||
| MIN(fp.created_at AT TIME ZONE 'America/New_York')::date AS "earliestPaymentDate", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| MAX(fp.created_at AT TIME ZONE 'America/New_York')::date AS "latestPaymentDate", | ||
| ls.payment_status_desc AS "currentPaymentStatus" | ||
| FROM filtered_payments fp | ||
| LEFT JOIN latest_status ls ON ls.billing_account = fp.billing_account | ||
| GROUP BY | ||
| fp.billing_account, | ||
| DATE_TRUNC('month', fp.created_at), | ||
| DATE_TRUNC('month', fp.created_at AT TIME ZONE 'America/New_York'), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| ls.payment_status_desc | ||
| ORDER BY fp.billing_account, "month" DESC; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| SELECT | ||
| p.id as "paymentId", | ||
| c.id as "challengeId", | ||
| c.name AS "challengeName", | ||
| p.billing_account as "billingAccountId", | ||
| c.status as "challengeStatus", | ||
| c."endDate" as "completeDate", | ||
| p.created_at as "paymentDate", | ||
| c."endDate" AT TIME ZONE 'America/New_York' as "completeDate", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| p.created_at AT TIME ZONE 'America/New_York' as "paymentDate", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| c."taskIsTask" AS "isTask", | ||
| p.challenge_fee as "challengeFee", | ||
| p.total_amount as "memberPayments", | ||
|
|
@@ -32,4 +33,3 @@ WHERE | |
| AND ($10::numeric IS NULL OR (p.total_amount + p.challenge_fee) >= $10::numeric) | ||
| AND ($11::numeric IS NULL OR (p.total_amount + p.challenge_fee) <= $11::numeric) | ||
| ORDER BY c."endDate" DESC, p.created_at DESC | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| LIMIT 1000; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| SELECT | ||
| p.payment_id as "paymentId", | ||
| p.created_at as "paymentDate", | ||
| p.created_at AT TIME ZONE 'America/New_York' as "paymentDate", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| p.billing_account as "billingAccountId", | ||
| p.payment_status as "paymentStatus", | ||
| p.challenge_fee as "challengeFee", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ SELECT | |
| j.max_salary AS "maxSalary", | ||
| j.hours_per_week AS "hoursPerWeek", | ||
| j.currency, | ||
| j.created_at AS "createdAt", | ||
| j.updated_at AS "updatedAt" | ||
| j.created_at AT TIME ZONE 'America/New_York' AS "createdAt", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| j.updated_at AT TIME ZONE 'America/New_York' AS "updatedAt" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| FROM taas.jobs j | ||
| WHERE | ||
| j.deleted_at IS NULL | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,8 @@ SELECT | |
| rb.customer_rate AS "customerRate", | ||
| rb.rate_type AS "rateType", | ||
| rb.billing_account_id AS "billingAccountId", | ||
| rb.created_at AS "createdAt", | ||
| rb.updated_at AS "updatedAt" | ||
| rb.created_at AT TIME ZONE 'America/New_York' AS "createdAt", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| rb.updated_at AT TIME ZONE 'America/New_York' AS "updatedAt" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| FROM taas.resource_bookings rb | ||
| LEFT JOIN identity."user" u ON rb.user_id = u.user_id::text | ||
| WHERE | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ SELECT | |
| reference_id AS "referenceId", | ||
| description, | ||
| payment_status_desc AS "paymentStatus", | ||
| created_at AS "paymentDate" | ||
| created_at AT TIME ZONE 'America/New_York' AS "paymentDate" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| FROM payment_data | ||
| WHERE | ||
| ($1::text IS NULL OR payment_status_desc ILIKE $1 OR payment_status::text ILIKE $1) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[⚠️
correctness]The addition of
AT TIME ZONE 'America/New_York'tofp.created_atensures that the date is correctly adjusted to the specified timezone. However, ensure that all relevant parts of the system are aware of this timezone change to avoid inconsistencies, especially if other parts of the system assume UTC or another timezone.