Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samvaerskalkulator gjenbruk #2813

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

ViktorGSolberg
Copy link
Contributor

@ViktorGSolberg ViktorGSolberg commented Mar 18, 2025

Hvorfor er denne endringen nødvendig? ✨

Tilhørende Favro

Denne PRen gjør det mulig å gjenbruke en og en samværsavtale. Når saksbehandler velger å individuelt gjenbruke et og et vilkår under "aleneomsorg" skal tilhørende samværsavtale også gjenbrukes.

APIet for å gjenbruke et enkelt vilkår returnerer nå alle samværsavtaler for tilhørende behandling i tillegg til det oppdaterte vilkåret.

Tilhørende frontend-PR:

@ViktorGSolberg ViktorGSolberg force-pushed the samvaerskalkulator-gjenbruk branch from 0b53b91 to 5c72b44 Compare March 18, 2025 08:32
@ViktorGSolberg ViktorGSolberg marked this pull request as ready for review March 19, 2025 08:45
@ViktorGSolberg ViktorGSolberg requested a review from a team as a code owner March 19, 2025 08:45
Comment on lines 105 to 126
@Transactional
fun gjenbrukSamværsavtale(
behandlingSomSkalOppdateresId: UUID,
behandlingForGjenbrukId: UUID,
barnPåBehandlingSomSkalOppdateres: List<BehandlingBarn>,
vilkårsvurderingSomSkalOppdateres: Vilkårsvurdering,
) {
validerBehandlingerForGjenbruk(behandlingSomSkalOppdateresId, behandlingForGjenbrukId)
validerVilkårsvurderingForGjenbruk(vilkårsvurderingSomSkalOppdateres)
val barnPåForrigeBehandling = barnService.finnBarnPåBehandling(behandlingForGjenbrukId)
val barnIdMap = byggBarnMapFraTidligereTilNyId(barnPåForrigeBehandling, barnPåBehandlingSomSkalOppdateres)
val barnPåBehandlingForGjenbrukId = barnIdMap.entries.find { it.value.id == vilkårsvurderingSomSkalOppdateres.barnId }?.key ?: error("Fant ikke barn på tidligere vilkårsvurdering")
val samværsavtaleForGjenbruk = hentSamværsavtalerForBehandling(behandlingForGjenbrukId).find { it.behandlingBarnId == barnPåBehandlingForGjenbrukId }

opprettEllerErstattSamværsavtale(
SamværsavtaleDto(
behandlingId = behandlingSomSkalOppdateresId,
behandlingBarnId = vilkårsvurderingSomSkalOppdateres.barnId ?: error("Mangler behandlingBarnId for gjenbruk av samværsavtale"),
uker = samværsavtaleForGjenbruk?.uker?.uker ?: emptyList(),
),
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dette er den nye service-metoden som lar oss gjenbruke en enkel samværsavtale.

)
val vilkårsVurderingForGjenbruk =
val vilkårsvurderingSomSkalOppdateres =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@krikof-nav krikof-nav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ViktorGSolberg ViktorGSolberg force-pushed the samvaerskalkulator-gjenbruk branch from a22bced to badcbf7 Compare March 20, 2025 13:19
fun kopierVurderingerTilNyBehandling(
eksisterendeBehandlingId: UUID,
nyBehandlingsId: UUID,
fun kopierVurderingerOgSamværsavtalerTilNyBehandling(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tror at jeg foretrekker at denne funksjonen er delt i vurderinger og samværsavtaler. Også kan man heller lage en ny funksjon som har dette navnet og kaller de to andre funksjonene

@ma10s ma10s requested a review from a team March 21, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants