@@ -1510,6 +1510,121 @@ internal class AttendanceReservationReportTest : FullApplicationTest(resetDbBefo
1510
1510
assertThat(result).containsExactlyElementsOf(expected.values)
1511
1511
}
1512
1512
1513
+ @Test
1514
+ fun `Only include departed children with realization report` () {
1515
+ val date = LocalDate .of(2020 , 5 , 28 )
1516
+ db.transaction { tx ->
1517
+ val placementId =
1518
+ tx.insert(
1519
+ DevPlacement (
1520
+ childId = testChild_1.id,
1521
+ unitId = testDaycare.id,
1522
+ startDate = date,
1523
+ endDate = date,
1524
+ )
1525
+ )
1526
+ tx.insert(
1527
+ DevDaycareGroupPlacement (
1528
+ daycarePlacementId = placementId,
1529
+ daycareGroupId = testDaycareGroup.id,
1530
+ startDate = date,
1531
+ endDate = date,
1532
+ )
1533
+ )
1534
+ tx.insert(
1535
+ DevChildAttendance (
1536
+ childId = testChild_1.id,
1537
+ unitId = testDaycare.id,
1538
+ date = date,
1539
+ arrived = LocalTime .of(8 , 0 ),
1540
+ departed = LocalTime .of(8 , 15 ),
1541
+ )
1542
+ )
1543
+
1544
+ val placementId2 =
1545
+ tx.insert(
1546
+ DevPlacement (
1547
+ childId = testChild_2.id,
1548
+ unitId = testDaycare.id,
1549
+ startDate = date,
1550
+ endDate = date,
1551
+ )
1552
+ )
1553
+ tx.insert(
1554
+ DevDaycareGroupPlacement (
1555
+ daycarePlacementId = placementId2,
1556
+ daycareGroupId = testDaycareGroup.id,
1557
+ startDate = date,
1558
+ endDate = date,
1559
+ )
1560
+ )
1561
+ tx.insert(
1562
+ DevChildAttendance (
1563
+ childId = testChild_2.id,
1564
+ unitId = testDaycare.id,
1565
+ date = date,
1566
+ arrived = LocalTime .of(8 , 0 ),
1567
+ departed = null ,
1568
+ )
1569
+ )
1570
+ tx.insert(
1571
+ DevStaffAttendance (
1572
+ employeeId = staff.id,
1573
+ groupId = testDaycareGroup.id,
1574
+ arrived = HelsinkiDateTime .of(date, LocalTime .of(8 , 0 )),
1575
+ departed = HelsinkiDateTime .of(date, LocalTime .of(8 , 30 )),
1576
+ modifiedAt = HelsinkiDateTime .of(date, LocalTime .of(8 , 0 )),
1577
+ modifiedBy = admin.evakaUserId,
1578
+ )
1579
+ )
1580
+
1581
+ tx.insert(testDecisionMaker_2)
1582
+ tx.insert(
1583
+ DevStaffAttendance (
1584
+ employeeId = testDecisionMaker_2.id,
1585
+ groupId = testDaycareGroup.id,
1586
+ arrived = HelsinkiDateTime .of(date, LocalTime .of(8 , 0 )),
1587
+ departed = HelsinkiDateTime .of(date, LocalTime .of(8 , 30 )),
1588
+ modifiedAt = HelsinkiDateTime .of(date, LocalTime .of(8 , 0 )),
1589
+ modifiedBy = admin.evakaUserId,
1590
+ occupancyCoefficient = BigDecimal .ZERO ,
1591
+ )
1592
+ )
1593
+ }
1594
+ val result = getReport(date, date, reservationType = ReservationType .REALIZATION )
1595
+ val expected =
1596
+ createEmptyReport(date, date).also {
1597
+ addExpectedRow(
1598
+ it,
1599
+ AttendanceReservationReportRow (
1600
+ groupId = null ,
1601
+ groupName = null ,
1602
+ HelsinkiDateTime .of(LocalDate .of(2020 , 5 , 28 ), LocalTime .of(8 , 0 )),
1603
+ childCountUnder3 = 1 ,
1604
+ childCountOver3 = 0 ,
1605
+ childCount = 1 ,
1606
+ capacityFactor = 1.75 ,
1607
+ staffCount = 1.0 ,
1608
+ unknownChildCount = 0 ,
1609
+ unknownChildCapacityFactor = 0.0 ,
1610
+ ),
1611
+ AttendanceReservationReportRow (
1612
+ groupId = null ,
1613
+ groupName = null ,
1614
+ HelsinkiDateTime .of(LocalDate .of(2020 , 5 , 28 ), LocalTime .of(8 , 15 )),
1615
+ childCountUnder3 = 1 ,
1616
+ childCountOver3 = 0 ,
1617
+ childCount = 1 ,
1618
+ capacityFactor = 1.75 ,
1619
+ staffCount = 1.0 ,
1620
+ unknownChildCount = 0 ,
1621
+ unknownChildCapacityFactor = 0.0 ,
1622
+ ),
1623
+ )
1624
+ }
1625
+ assertThat(result).containsExactlyElementsOf(expected.values)
1626
+ }
1627
+
1513
1628
private fun getReport (
1514
1629
startDate : LocalDate ,
1515
1630
endDate : LocalDate ,
0 commit comments