Skip to content

Commit c2345c2

Browse files
authored
Merge pull request #1625 from GSA/main
3-27-2025 Production release
2 parents d47c829 + 555b10d commit c2345c2

File tree

7 files changed

+128
-49
lines changed

7 files changed

+128
-49
lines changed

.github/workflows/deploy-demo.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,25 @@ jobs:
7474
--var LOGIN_DOT_GOV_REGISTRATION_URL="$LOGIN_DOT_GOV_REGISTRATION_URL"
7575
--strategy rolling
7676
77-
# TODO FIX
78-
# - name: Update templates
79-
# run: cf run-task notify-api-demo --command "flask command update-templates"
77+
- name: Update templates
78+
uses: cloud-gov/cg-cli-tools@main
79+
env:
80+
DANGEROUS_SALT: ${{ secrets.DANGEROUS_SALT }}
81+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
82+
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
83+
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
84+
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
85+
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
86+
LOGIN_DOT_GOV_REGISTRATION_URL: "https://secure.login.gov/openid_connect/authorize?acr_values=http%3A%2F%2Fidmanagement.gov%2Fns%2Fassurance%2Fial%2F1&client_id=urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:notify-gov&nonce=NONCE&prompt=select_account&redirect_uri=https://notify-demo.app.cloud.gov/set-up-your-profile&response_type=code&scope=openid+email&state=STATE"
87+
88+
with:
89+
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
90+
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
91+
cf_org: gsa-tts-benefits-studio
92+
cf_space: notify-demo
93+
cf_command: >-
94+
run-task notify-api-demo --command "flask command update-templates"
95+
8096
8197
- name: Deploy egress proxy
8298
uses: ./.github/actions/deploy-proxy

.github/workflows/deploy-prod.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,24 @@ jobs:
7878
--var LOGIN_DOT_GOV_REGISTRATION_URL="$LOGIN_DOT_GOV_REGISTRATION_URL"
7979
--strategy rolling
8080
81-
# TODO FIX
82-
# - name: Update templates
83-
# run: cf run-task notify-api-production --command "flask command update-templates"
81+
- name: Update templates
82+
uses: cloud-gov/cg-cli-tools@main
83+
env:
84+
DANGEROUS_SALT: ${{ secrets.DANGEROUS_SALT }}
85+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
86+
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
87+
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
88+
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
89+
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
90+
LOGIN_DOT_GOV_REGISTRATION_URL: "https://secure.login.gov/openid_connect/authorize?acr_values=http%3A%2F%2Fidmanagement.gov%2Fns%2Fassurance%2Fial%2F1&client_id=urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:notify-gov&nonce=NONCE&prompt=select_account&redirect_uri=https://beta.notify.gov/set-up-your-profile&response_type=code&scope=openid+email&state=STATE"
91+
92+
with:
93+
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
94+
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
95+
cf_org: gsa-tts-benefits-studio
96+
cf_space: notify-production
97+
cf_command: >-
98+
run-task notify-api-production --command "flask command update-templates"
8499
85100
- name: Deploy egress proxy
86101
uses: ./.github/actions/deploy-proxy

.github/workflows/deploy.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,23 @@ jobs:
8080
--var LOGIN_DOT_GOV_REGISTRATION_URL="$LOGIN_DOT_GOV_REGISTRATION_URL"
8181
--strategy rolling
8282
83-
# TODO FIX
84-
# - name: Update templates
85-
# run: cf run-task notify-api-staging --command "flask command update-templates"
83+
- name: Update templates
84+
uses: cloud-gov/cg-cli-tools@main
85+
env:
86+
DANGEROUS_SALT: ${{ secrets.DANGEROUS_SALT }}
87+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
88+
ADMIN_CLIENT_SECRET: ${{ secrets.ADMIN_CLIENT_SECRET }}
89+
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
90+
NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }}
91+
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
92+
LOGIN_DOT_GOV_REGISTRATION_URL: "https://secure.login.gov/openid_connect/authorize?acr_values=http%3A%2F%2Fidmanagement.gov%2Fns%2Fassurance%2Fial%2F1&client_id=urn:gov:gsa:openidconnect.profiles:sp:sso:gsa:notify-gov&nonce=NONCE&prompt=select_account&redirect_uri=https://notify-staging.app.cloud.gov/set-up-your-profile&response_type=code&scope=openid+email&state=STATE"
93+
with:
94+
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
95+
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
96+
cf_org: gsa-tts-benefits-studio
97+
cf_space: notify-staging
98+
cf_command: >-
99+
run-task notify-api-staging --command "flask command update-templates"
86100
87101
- name: Deploy egress proxy
88102
uses: ./.github/actions/deploy-proxy

.github/workflows/restage-apps.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,46 @@ jobs:
1818
matrix:
1919
app: ["api", "admin"]
2020
steps:
21+
- name: Update env variables api
22+
uses: cloud-gov/cg-cli-tools@main
23+
with:
24+
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
25+
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
26+
cf_org: gsa-tts-benefits-studio
27+
cf_space: notify-${{ inputs.environment }}
28+
command: |
29+
cf set-env notify-api-${{inputs.environment}} DANGEROUS_SALT "${{secrets.DANGEROUS_SALT}}"
30+
cf set-env notify-api-${{inputs.environment}} ADMIN_CLIENT_SECRET "${{secrets.ADMIN_CLIENT_SECRET}}"
31+
cf set-env notify-api-${{inputs.environment}} SECRET_KEY "${{secrets.SECRET_KEY}}"
32+
cf set-env notify-api-${{inputs.environment}} LOGIN_PEM "${{secrets.LOGIN_PEM}}"
33+
cf set-env notify-api-${{inputs.environment}} NOTIFY_E2E_TEST_EMAIL "${{secrets.NOTIFY_E2E_TEST_EMAIL}}"
34+
cf set-env notify-api-${{inputs.environment}} NOTIFY_E2E_TEST_PASSWORD "${{secrets.NOTIFY_E2E_TEST_PASSWORD}}"
35+
36+
- name: Update env variables admin
37+
uses: cloud-gov/cg-cli-tools@main
38+
with:
39+
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
40+
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
41+
cf_org: gsa-tts-benefits-studio
42+
cf_space: notify-${{ inputs.environment }}
43+
command: |
44+
cf set-env notify-admin-${{inputs.environment}} DANGEROUS_SALT "${{secrets.DANGEROUS_SALT}}"
45+
cf set-env notify-admin-${{inputs.environment}} ADMIN_CLIENT_SECRET "${{secrets.ADMIN_CLIENT_SECRET}}"
46+
cf set-env notify-admin-${{inputs.environment}} SECRET_KEY "${{secrets.SECRET_KEY}}"
47+
cf set-env notify-admin-${{inputs.environment}} LOGIN_PEM "${{secrets.LOGIN_PEM}}"
48+
cf set-env notify-admin-${{inputs.environment}} NOTIFY_E2E_TEST_EMAIL "${{secrets.NOTIFY_E2E_TEST_EMAIL}}"
49+
cf set-env notify-admin-${{inputs.environment}} NOTIFY_E2E_TEST_PASSWORD "${{secrets.NOTIFY_E2E_TEST_PASSWORD}}"
50+
cf set-env notify-api-${{inputs.environment}} E2E_BUCKET_NAME "${{secrets.E2E_BUCKET_NAME}}"
51+
2152
- name: Restage ${{matrix.app}}
2253
uses: cloud-gov/cg-cli-tools@main
2354
with:
2455
cf_username: ${{ secrets.CLOUDGOV_USERNAME }}
2556
cf_password: ${{ secrets.CLOUDGOV_PASSWORD }}
2657
cf_org: gsa-tts-benefits-studio
2758
cf_space: notify-${{ inputs.environment }}
28-
command: "cf restage --strategy rolling notify-${{matrix.app}}-${{inputs.environment}}"
59+
command: |
60+
cf restage --strategy rolling notify-${{matrix.app}}-${{inputs.environment}}
2961
- name: Restage ${{matrix.app}} egress
3062
uses: cloud-gov/cg-cli-tools@main
3163
with:

app/dao/services_dao.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def dao_fetch_stats_for_service_from_days_for_user(
604604

605605
total_substmt = (
606606
select(
607-
func.date_trunc("day", NotificationAllTimeView.created_at).label("day"),
607+
func.date_trunc("hour", NotificationAllTimeView.created_at).label("hour"),
608608
Job.notification_count.label("notification_count"),
609609
)
610610
.join(Job, NotificationAllTimeView.job_id == Job.id)
@@ -618,25 +618,25 @@ def dao_fetch_stats_for_service_from_days_for_user(
618618
.group_by(
619619
Job.id,
620620
Job.notification_count,
621-
func.date_trunc("day", NotificationAllTimeView.created_at),
621+
func.date_trunc("hour", NotificationAllTimeView.created_at),
622622
)
623623
.subquery()
624624
)
625625

626626
total_stmt = select(
627-
total_substmt.c.day,
627+
total_substmt.c.hour,
628628
func.sum(total_substmt.c.notification_count).label("total_notifications"),
629-
).group_by(total_substmt.c.day)
629+
).group_by(total_substmt.c.hour)
630630

631631
total_notifications = {
632-
row.day: row.total_notifications for row in db.session.execute(total_stmt).all()
632+
row.hour: row.total_notifications for row in db.session.execute(total_stmt).all()
633633
}
634634

635635
stmt = (
636636
select(
637637
NotificationAllTimeView.notification_type,
638638
NotificationAllTimeView.status,
639-
func.date_trunc("day", NotificationAllTimeView.created_at).label("day"),
639+
func.date_trunc("hour", NotificationAllTimeView.created_at).label("hour"),
640640
func.count(NotificationAllTimeView.id).label("count"),
641641
)
642642
.where(
@@ -649,7 +649,7 @@ def dao_fetch_stats_for_service_from_days_for_user(
649649
.group_by(
650650
NotificationAllTimeView.notification_type,
651651
NotificationAllTimeView.status,
652-
func.date_trunc("day", NotificationAllTimeView.created_at),
652+
func.date_trunc("hour", NotificationAllTimeView.created_at),
653653
)
654654
)
655655

app/service/rest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,12 @@ def get_service_statistics_for_specific_days_by_user(
282282
service_id, start_date, end_date, user_id
283283
)
284284

285-
stats = get_specific_days_stats(
285+
hours = days * 24
286+
287+
stats = get_specific_hours_stats(
286288
results,
287289
start_date,
288-
days=days,
290+
hours=hours,
289291
total_notifications=total_notifications,
290292
)
291293
return stats

poetry.lock

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)