Skip to content

Commit

Permalink
Merge pull request #1360 from ministryofjustice/781-incl-submitted-at…
Browse files Browse the repository at this point in the history
…-timestamp-in-submitted-applications-mi-report

(781) CAS2: Present submittedAt as timestamp rather than date in 'Submitted applications' report
  • Loading branch information
edavey authored Jan 25, 2024
2 parents d7e977a + d64bd19 commit 43a2cfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ interface Cas2SubmittedApplicationReportRepository : JpaRepository<DomainEventEn
events.data -> 'eventDetails' ->> 'preferredAreas' AS preferredAreas,
CAST(events.data -> 'eventDetails' ->> 'hdcEligibilityDate' as DATE) AS hdcEligibilityDate,
CAST(events.data -> 'eventDetails' ->> 'conditionalReleaseDate' as DATE) AS conditionalReleaseDate,
CAST(
CAST(events.data -> 'eventDetails' ->> 'submittedAt' as DATE)
as TEXT) as submittedAt
TO_CHAR(
CAST(events.data -> 'eventDetails' ->> 'submittedAt' AS TIMESTAMP),
'YYYY-MM-DD"T"HH24:MI:SS'
) AS submittedAt
FROM domain_events events
WHERE events.type = 'CAS2_APPLICATION_SUBMITTED'
AND events.occurred_at > CURRENT_DATE - 365
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Cas2ReportsTest : IntegrationTestBase() {
preferredAreas = event2Details.preferredAreas.toString(),
hdcEligibilityDate = event2Details.hdcEligibilityDate.toString(),
conditionalReleaseDate = event2Details.conditionalReleaseDate.toString(),
submittedAt = event2Details.submittedAt.toString().split("T").first(),
submittedAt = event2Details.submittedAt.toString().split(".").first(),
submittedBy = event2Details.submittedBy.staffMember.username.toString(),
),
SubmittedApplicationReportRow(
Expand All @@ -196,7 +196,7 @@ class Cas2ReportsTest : IntegrationTestBase() {
preferredAreas = event1Details.preferredAreas.toString(),
hdcEligibilityDate = event1Details.hdcEligibilityDate.toString(),
conditionalReleaseDate = event1Details.conditionalReleaseDate.toString(),
submittedAt = event1Details.submittedAt.toString().split("T").first(),
submittedAt = event1Details.submittedAt.toString().split(".").first(),
submittedBy = event1Details.submittedBy.staffMember.username.toString(),
),
)
Expand Down

0 comments on commit 43a2cfd

Please sign in to comment.