Skip to content

Commit

Permalink
Merge pull request #5722 from espoon-voltti/placement-modifier
Browse files Browse the repository at this point in the history
Näytetään työntekijälle sijoituksen viimeisimmän muokkauksen aikaleima ja tekijä
  • Loading branch information
msavolainen-gofore authored Oct 1, 2024
2 parents 7b9f88f + 3c168b2 commit e7987d8
Show file tree
Hide file tree
Showing 18 changed files with 459 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,22 @@ export default React.memo(function PlacementRow({
/>
</WarningRow>
)}
{placement.modifiedAt && (
<DataRow>
<DataLabel>{i18n.childInformation.placements.modifiedAt}</DataLabel>
<DataValue data-qa="placement-modified-at">
{placement.modifiedAt.format()}
</DataValue>
</DataRow>
)}
{placement.modifiedBy && (
<DataRow>
<DataLabel>{i18n.childInformation.placements.modifiedBy}</DataLabel>
<DataValue data-qa="placement-modified-by">
{placement.modifiedBy.name}
</DataValue>
</DataRow>
)}
{placement.terminationRequestedDate && (
<DataRow>
<DataLabel>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib-common/generated/api-types/placement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// GENERATED FILE: no manual modifications

import FiniteDateRange from '../../finite-date-range'
import HelsinkiDateTime from '../../helsinki-date-time'
import LocalDate from '../../local-date'
import { Action } from '../action'
import { EvakaUser } from './user'
Expand Down Expand Up @@ -87,6 +88,8 @@ export interface DaycarePlacementWithDetails {
id: UUID
isRestrictedFromUser: boolean
missingServiceNeedDays: number
modifiedAt: HelsinkiDateTime | null
modifiedBy: EvakaUser | null
placeGuarantee: boolean
serviceNeeds: ServiceNeed[]
startDate: LocalDate
Expand Down Expand Up @@ -382,6 +385,7 @@ export function deserializeJsonDaycarePlacementWithDetails(json: JsonOf<DaycareP
child: deserializeJsonChildBasics(json.child),
endDate: LocalDate.parseIso(json.endDate),
groupPlacements: json.groupPlacements.map(e => deserializeJsonDaycareGroupPlacement(e)),
modifiedAt: (json.modifiedAt != null) ? HelsinkiDateTime.parseIso(json.modifiedAt) : null,
serviceNeeds: json.serviceNeeds.map(e => deserializeJsonServiceNeed(e)),
startDate: LocalDate.parseIso(json.startDate),
terminationRequestedDate: (json.terminationRequestedDate != null) ? LocalDate.parseIso(json.terminationRequestedDate) : null
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,8 @@ export const fi = {
rowTitle: 'Sijoituspäätös voimassa',
startDate: 'Aloituspäivämäärä',
endDate: 'Päättymispäivämäärä',
modifiedAt: 'Muokattu',
modifiedBy: 'Muutoksentekijä',
terminatedByGuardian: 'Huoltaja irtisanonut',
terminated: 'Irtisanottu',
area: 'Alue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(5), day(20)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(5),
day(20),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(5, 9) to 1))
Expand All @@ -118,7 +126,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(15), day(20)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(15),
day(20),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(10, 14) to 0, dateRange(15, 20) to 1))
Expand All @@ -135,7 +151,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `end date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(10), day(15)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(15),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(16, 20) to 0))
Expand All @@ -147,7 +171,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `end date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(10), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(21, 25) to 1))
Expand All @@ -164,7 +196,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves earlier and end date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(5), day(15)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(5),
day(15),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(5, 9) to 1, dateRange(16, 20) to 0))
Expand All @@ -181,7 +221,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves earlier and end date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(5), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(5),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(5, 9) to 1, dateRange(21, 25) to 1))
Expand All @@ -199,7 +247,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves later and end date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(15), day(15)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(15),
day(15),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(10, 14) to 0, dateRange(15, 15) to 1, dateRange(16, 20) to 0))
Expand All @@ -216,7 +272,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves later and end date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(15), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(15),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(10, 14) to 0, dateRange(15, 25) to 1))
Expand All @@ -234,7 +298,13 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :
@Test
fun `break in placement on days 14-15`() {
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(placementId, day(10), day(13))
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(13),
now.now(),
testDecisionMaker_2.evakaUserId,
)
tx.insert(
DevPlacement(
id = PlacementId(UUID.randomUUID()),
Expand Down Expand Up @@ -271,7 +341,15 @@ class FeeDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `end date moves later then draft is ignored`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(10), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()
assertDrafts(listOf(dateRange(21, 25) to 1))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(5), day(20)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(5),
day(20),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(5, 9) to false))
Expand All @@ -120,7 +128,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(15), day(20)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(15),
day(20),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(10, 14) to true, dateRange(15, 20) to false))
Expand All @@ -137,7 +153,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `end date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(10), day(15)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(15),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(16, 20) to true))
Expand All @@ -149,7 +173,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `end date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(10), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(21, 25) to false))
Expand All @@ -166,7 +198,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves earlier and end date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(5), day(15)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(5),
day(15),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(5, 9) to false, dateRange(16, 20) to true))
Expand All @@ -183,7 +223,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves earlier and end date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(5), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(5),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(5, 9) to false, dateRange(21, 25) to false))
Expand All @@ -201,7 +249,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves later and end date moves earlier`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(15), day(15)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(15),
day(15),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(
Expand All @@ -220,7 +276,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `start date moves later and end date moves later`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(15), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(15),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()

assertDrafts(listOf(dateRange(10, 14) to true, dateRange(15, 25) to false))
Expand All @@ -238,7 +302,13 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :
@Test
fun `break in placement on days 14-15`() {
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(placementId, day(10), day(13))
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(13),
now.now(),
testDecisionMaker_2.evakaUserId,
)
tx.insert(
DevPlacement(
id = PlacementId(UUID.randomUUID()),
Expand Down Expand Up @@ -275,7 +345,15 @@ class VoucherValueDecisionGenerationForDataChangesIntegrationTest :

@Test
fun `end date moves later then draft is ignored`() {
db.transaction { tx -> tx.updatePlacementStartAndEndDate(placementId, day(10), day(25)) }
db.transaction { tx ->
tx.updatePlacementStartAndEndDate(
placementId,
day(10),
day(25),
now.now(),
testDecisionMaker_2.evakaUserId,
)
}
generate()
assertDrafts(listOf(dateRange(21, 25) to false))

Expand Down
Loading

0 comments on commit e7987d8

Please sign in to comment.