diff --git a/frontend/src/e2e-test/dev-api/fixtures.ts b/frontend/src/e2e-test/dev-api/fixtures.ts index 09dbf5d8a5..f7f52e514c 100644 --- a/frontend/src/e2e-test/dev-api/fixtures.ts +++ b/frontend/src/e2e-test/dev-api/fixtures.ts @@ -267,7 +267,8 @@ export class Fixture { startDate: LocalDate.of(2020, 1, 1), endDate: null, jamixCustomerNumber: null, - ...initial + ...initial, + aromiCustomerId: initial.aromiCustomerId ?? null }) } @@ -3144,7 +3145,8 @@ export const testDaycareGroup: DevDaycareGroup = { name: 'Kosmiset vakiot', startDate: LocalDate.of(2000, 1, 1), endDate: null, - jamixCustomerNumber: null + jamixCustomerNumber: null, + aromiCustomerId: null } /** diff --git a/frontend/src/e2e-test/generated/api-types.ts b/frontend/src/e2e-test/generated/api-types.ts index f6de7470db..41a5c8bcd6 100644 --- a/frontend/src/e2e-test/generated/api-types.ts +++ b/frontend/src/e2e-test/generated/api-types.ts @@ -530,6 +530,7 @@ export interface DevDaycareAssistance { * Generated from fi.espoo.evaka.shared.dev.DevDaycareGroup */ export interface DevDaycareGroup { + aromiCustomerId: string | null daycareId: DaycareId endDate: LocalDate | null id: GroupId diff --git a/frontend/src/e2e-test/specs/7_messaging/messaging.spec.ts b/frontend/src/e2e-test/specs/7_messaging/messaging.spec.ts index 86b55a4e42..ca8c6e69cb 100644 --- a/frontend/src/e2e-test/specs/7_messaging/messaging.spec.ts +++ b/frontend/src/e2e-test/specs/7_messaging/messaging.spec.ts @@ -135,7 +135,8 @@ beforeEach(async () => { name: 'Varayksikön ryhmä', startDate: LocalDate.of(2000, 1, 1), endDate: null, - jamixCustomerNumber: null + jamixCustomerNumber: null, + aromiCustomerId: null } ] }) diff --git a/frontend/src/employee-frontend/components/reports/Raw.tsx b/frontend/src/employee-frontend/components/reports/Raw.tsx index c6a2027774..7c181dc740 100755 --- a/frontend/src/employee-frontend/components/reports/Raw.tsx +++ b/frontend/src/employee-frontend/components/reports/Raw.tsx @@ -177,7 +177,11 @@ export default React.memo(function Raw() { { label: 'Poissa maksullisesta', key: 'absencePaid' }, { label: 'Poissa maksuttomasta', key: 'absenceFree' }, { label: 'Henkilöstömitoitus', key: 'staffDimensioning' }, - { label: 'Kotikunta', key: 'municipalityOfResidence' } + { label: 'Kotikunta', key: 'municipalityOfResidence' }, + { + label: 'Ryhmäkohtainen Aromin asiakastunniste', + key: 'aromiCustomerId' + } ]} filename={`${ i18n.reports.raw.title diff --git a/frontend/src/lib-common/generated/api-types/reports.ts b/frontend/src/lib-common/generated/api-types/reports.ts index 99bc5beca8..1592a039ba 100644 --- a/frontend/src/lib-common/generated/api-types/reports.ts +++ b/frontend/src/lib-common/generated/api-types/reports.ts @@ -794,6 +794,7 @@ export interface RawReportRow { absenceFree: AbsenceType | null absencePaid: AbsenceType | null age: number + aromiCustomerId: string | null assistanceNeedVoucherCoefficient: number | null backupGroupId: GroupId | null backupUnitId: DaycareId | null diff --git a/service/src/integrationTest/kotlin/fi/espoo/evaka/reports/RawReportControllerTest.kt b/service/src/integrationTest/kotlin/fi/espoo/evaka/reports/RawReportControllerTest.kt index f4f08b3b18..cacf1bdffc 100644 --- a/service/src/integrationTest/kotlin/fi/espoo/evaka/reports/RawReportControllerTest.kt +++ b/service/src/integrationTest/kotlin/fi/espoo/evaka/reports/RawReportControllerTest.kt @@ -8,6 +8,8 @@ import fi.espoo.evaka.FullApplicationTest import fi.espoo.evaka.shared.auth.UserRole import fi.espoo.evaka.shared.dev.DevCareArea import fi.espoo.evaka.shared.dev.DevDaycare +import fi.espoo.evaka.shared.dev.DevDaycareGroup +import fi.espoo.evaka.shared.dev.DevDaycareGroupPlacement import fi.espoo.evaka.shared.dev.DevEmployee import fi.espoo.evaka.shared.dev.DevPerson import fi.espoo.evaka.shared.dev.DevPersonType @@ -163,4 +165,92 @@ class RawReportControllerTest : FullApplicationTest(resetDbBeforeEach = true) { Tuple("Kotikunnaton", ""), ) } + + @Test + fun `aromi customer id is shown correctly`() { + val clock = + MockEvakaClock(HelsinkiDateTime.of(LocalDate.of(2024, 10, 23), LocalTime.of(8, 47))) + + val user = + db.transaction { tx -> + val admin = DevEmployee(roles = setOf(UserRole.ADMIN)) + tx.insert(admin) + admin.user + } + val testArea = DevCareArea() + val testUnit = DevDaycare(areaId = testArea.id) + val aromiGroup = + DevDaycareGroup( + daycareId = testUnit.id, + name = "Aromi group", + aromiCustomerId = "DAYCARE_PK", + ) + db.transaction { tx -> + tx.insertServiceNeedOption(snDefaultDaycare) + tx.insert(testArea) + tx.insert(testUnit) + + val nonAromiGroupId = + tx.insert(DevDaycareGroup(daycareId = testUnit.id, name = "Non-Aromi group")) + + tx.insert(aromiGroup) + + tx.insert(DevPerson(firstName = "Anselmi"), DevPersonType.CHILD).also { childId -> + val aromiPlacementId = + tx.insert( + DevPlacement( + childId = childId, + unitId = testUnit.id, + startDate = clock.today().minusYears(1), + endDate = clock.today().plusYears(1), + ) + ) + tx.insert( + DevDaycareGroupPlacement( + daycarePlacementId = aromiPlacementId, + daycareGroupId = aromiGroup.id, + startDate = clock.today().minusYears(1), + endDate = clock.today().plusYears(1), + ) + ) + } + + tx.insert(DevPerson(firstName = "Benselmi"), DevPersonType.CHILD).also { childId -> + val nonAromiPlacementId = + tx.insert( + DevPlacement( + childId = childId, + unitId = testUnit.id, + startDate = clock.today().minusYears(1), + endDate = clock.today().plusYears(1), + ) + ) + + tx.insert( + DevDaycareGroupPlacement( + daycarePlacementId = nonAromiPlacementId, + daycareGroupId = nonAromiGroupId, + startDate = clock.today().minusYears(1), + endDate = clock.today().plusYears(1), + ) + ) + } + } + + val rows = + rawReportController.getRawReport( + dbInstance(), + user, + clock, + clock.today(), + clock.today(), + ) + + assertThat(rows) + .extracting({ it.firstName }, { it.aromiCustomerId }) + .containsExactlyInAnyOrder( + Tuple("Anselmi", aromiGroup.aromiCustomerId), + Tuple("Benselmi", null), + ) + } } diff --git a/service/src/main/kotlin/fi/espoo/evaka/reports/RawReport.kt b/service/src/main/kotlin/fi/espoo/evaka/reports/RawReport.kt index ced599f767..df3dc479e7 100755 --- a/service/src/main/kotlin/fi/espoo/evaka/reports/RawReport.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/reports/RawReport.kt @@ -120,7 +120,7 @@ SELECT coalesce(sn.part_week, false) AS part_week, coalesce(sn.shift_care, 'NONE') = 'FULL' AS shift_care, coalesce(sno.daycare_hours_per_week, 0.0) AS hours_per_week, - + dg.aromi_customer_id, ( an IS NOT NULL OR EXISTS(SELECT FROM assistance_action aa WHERE aa.child_id = pl.child_id AND t::date BETWEEN aa.start_date AND aa.end_date) @@ -220,4 +220,5 @@ data class RawReportRow( val isWeekday: Boolean, val isHoliday: Boolean, val municipalityOfResidence: String, + val aromiCustomerId: String?, ) diff --git a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt index 51f4a447fb..5194ae669f 100755 --- a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt @@ -620,8 +620,8 @@ fun Database.Transaction.insert(row: DevDaycareGroup): GroupId = createUpdate { sql( """ -INSERT INTO daycare_group (id, daycare_id, name, start_date, end_date, jamix_customer_number) -VALUES (${bind(row.id)}, ${bind(row.daycareId)}, ${bind(row.name)}, ${bind(row.startDate)}, ${bind(row.endDate)}, ${bind(row.jamixCustomerNumber)}) +INSERT INTO daycare_group (id, daycare_id, name, start_date, end_date, jamix_customer_number, aromi_customer_id) +VALUES (${bind(row.id)}, ${bind(row.daycareId)}, ${bind(row.name)}, ${bind(row.startDate)}, ${bind(row.endDate)}, ${bind(row.jamixCustomerNumber)}, ${bind(row.aromiCustomerId)}) """ ) } diff --git a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt index ba29337580..8c16eaf3b2 100755 --- a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt @@ -1972,7 +1972,7 @@ data class DevDaycareGroup( val startDate: LocalDate = LocalDate.of(2019, 1, 1), val endDate: LocalDate? = null, val jamixCustomerNumber: Int? = null, - val aromiCustomerNumber: String? = null, + val aromiCustomerId: String? = null, ) data class DevDaycareGroupPlacement(