From d0c18a74b0080c35ae7979c2ea03ee9373b45b2b Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Thu, 4 Apr 2024 11:26:13 -0700 Subject: [PATCH] Add in TZ conversion (#1459) --- .../daily/vs_reconciliation_details.ipynb | 6 ++--- .../monthly/vs_reconciliation_summary.ipynb | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/jobs/notebook-report/daily/vs_reconciliation_details.ipynb b/jobs/notebook-report/daily/vs_reconciliation_details.ipynb index 0796e728e..d46002348 100644 --- a/jobs/notebook-report/daily/vs_reconciliation_details.ipynb +++ b/jobs/notebook-report/daily/vs_reconciliation_details.ipynb @@ -131,7 +131,7 @@ "outputs": [], "source": [ "%%sql\n", - "select now() AT TIME ZONE 'PST' as current_date" + "select now() AT TIME ZONE 'america/vancouver' as current_date" ] }, { @@ -172,8 +172,8 @@ "WHERE i.corp_type_code = :partner_code\n", "AND i.invoice_status_code IN ('PAID', 'REFUNDED', 'CANCELLED', 'CREDITED')\n", "AND i.payment_method_code IN ('PAD','EJV', 'DRAWDOWN')\n", - "AND date(i.created_on) > date(current_date - 1 - interval '1 days')\n", - "AND date(i.created_on) <= date(current_date - 1)\n", + "AND date(i.created_on at time zone 'utc' at time zone 'america/vancouver') > date(current_date - 1 - interval '1 days')\n", + "AND date(i.created_on at time zone 'utc' at time zone 'america/vancouver') <= date(current_date - 1)\n", "ORDER BY 1;" ] }, diff --git a/jobs/notebook-report/monthly/vs_reconciliation_summary.ipynb b/jobs/notebook-report/monthly/vs_reconciliation_summary.ipynb index a78fadc05..5ec9c112d 100644 --- a/jobs/notebook-report/monthly/vs_reconciliation_summary.ipynb +++ b/jobs/notebook-report/monthly/vs_reconciliation_summary.ipynb @@ -138,7 +138,7 @@ "outputs": [], "source": [ "%%sql\n", - "select now() AT TIME ZONE 'PST' as current_date" + "select now() AT TIME ZONE 'america/vancouver' as current_date" ] }, { @@ -161,11 +161,11 @@ "outputs": [], "source": [ "%%sql monthly_reconciliation_summary <<\n", - "SELECT count(*) AS transaction_count,\n", + "SELECT\n", "sum(pli.total) AS subtotal,\n", "sum(pli.service_fees) AS service_fees,\n", "sum(pli.total + pli.service_fees) AS total,\n", - "(i.payment_date)::date,\n", + "(i.payment_date at time zone 'utc' at time zone 'america/vancouver')::date,\n", "pli.description,\n", "i.payment_method_code,\n", "i.corp_type_code\n", @@ -174,10 +174,10 @@ "WHERE i.corp_type_code = :partner_code\n", "AND i.invoice_status_code = 'PAID'\n", "AND i.payment_method_code IN ('PAD', 'EJV', 'DIRECT_PAY', 'DRAWDOWN')\n", - "AND date(i.payment_date) > date(current_date - 1 - interval '1 months')\n", - "AND date(i.payment_date) <= date(current_date - 1)\n", - "GROUP BY (i.payment_date)::date, i.payment_method_code, i.corp_type_code, pli.description\n", - "ORDER BY (i.payment_date)::date, pli.description, i.payment_method_code;" + "AND date(i.payment_date at time zone 'utc' at time zone 'america/vancouver') > date(current_date - 1 - interval '1 months')\n", + "AND date(i.payment_date at time zone 'utc' at time zone 'america/vancouver') <= date(current_date - 1)\n", + "GROUP BY (i.payment_date at time zone 'utc' at time zone 'america/vancouver')::date, i.payment_method_code, i.corp_type_code, pli.description\n", + "ORDER BY (i.payment_date at time zone 'utc' at time zone 'america/vancouver')::date, pli.description, i.payment_method_code" ] }, { @@ -226,7 +226,7 @@ "sum(pli.total) AS sub_total,\n", "sum(pli.service_fees) AS service_fees,\n", "sum(pli.total + pli.service_fees) AS total,\n", - "(i.disbursement_date)::date,\n", + "(i.disbursement_date at time zone 'utc' at time zone 'america/vancouver')::date,\n", "pli.description,\n", "i.payment_method_code,\n", "i.corp_type_code\n", @@ -236,10 +236,10 @@ "AND i.invoice_status_code = 'PAID'\n", "AND i.payment_method_code IN ('PAD', 'EJV', 'DIRECT_PAY')\n", "AND i.disbursement_status_code = 'COMPLETED'\n", - "AND date(disbursement_date) > date(current_date - 1 - interval '1 months')\n", - "AND date(disbursement_date) <= date(current_date - 1)\n", - "GROUP BY (disbursement_date)::date, payment_method_code, corp_type_code, pli.description\n", - "ORDER BY (disbursement_date)::date, pli.description, i.payment_method_code;" + "AND date(disbursement_date at time zone 'utc' at time zone 'america/vancouver') > date(current_date - 1 - interval '1 months')\n", + "AND date(disbursement_date at time zone 'utc' at time zone 'america/vancouver') <= date(current_date - 1)\n", + "GROUP BY (disbursement_date at time zone 'utc' at time zone 'america/vancouver')::date, payment_method_code, corp_type_code, pli.description\n", + "ORDER BY (disbursement_date at time zone 'utc' at time zone 'america/vancouver')::date, pli.description, i.payment_method_code;" ] }, {