Skip to content

Commit

Permalink
FAGSYSTEM-364737: Kan sette foreldreløssats i overstyrt beregning (#6790
Browse files Browse the repository at this point in the history
)

* FAGSYSTEM-364737: Kan sette foreldreløssats i overstyrt beregning

* FAGSYSTEM-364737: Ikke vise foreldreløssats for Omstillingsstønad
  • Loading branch information
henrikg authored Jan 17, 2025
1 parent ee7e48d commit 4493f7f
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class BeregnOverstyrBeregningService(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 0,
trygdetid = 0,
foreldreloessats = null,
trygdetidForIdent = null,
prorataBroekTeller = null,
prorataBroekNevner = null,
Expand Down Expand Up @@ -227,6 +228,7 @@ class BeregnOverstyrBeregningService(
utbetaltBeloep =
periodisertResultat.resultat.verdi.utbetaltBeloep
.toInt(),
harForeldreloessats = periodisertResultat.resultat.verdi.foreldreloessats,
institusjonsopphold = null,
grunnbelopMnd = grunnbeloep.grunnbeloepPerMaaned,
grunnbelop = grunnbeloep.grunnbeloep,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class BeregningsGrunnlagRepository(
"dato_fom" to grunnlag.datoFOM,
"dato_tom" to grunnlag.datoTOM,
"utbetalt_beloep" to grunnlag.utbetaltBeloep,
"har_foreldreloessats" to grunnlag.foreldreloessats,
"trygdetid" to grunnlag.trygdetid,
"trygdetid_for_ident" to grunnlag.trygdetidForIdent,
"prorata_broek_teller" to grunnlag.prorataBroekTeller,
Expand Down Expand Up @@ -171,6 +172,7 @@ class BeregningsGrunnlagRepository(
dato_fra_og_med,
dato_til_og_med,
utbetalt_beloep,
har_foreldreloessats,
trygdetid,
trygdetid_for_ident,
prorata_broek_teller,
Expand Down Expand Up @@ -198,6 +200,7 @@ class BeregningsGrunnlagRepository(
dato_fra_og_med,
dato_til_og_med,
utbetalt_beloep,
har_foreldreloessats,
trygdetid,
trygdetid_for_ident,
prorata_broek_teller,
Expand All @@ -214,6 +217,7 @@ class BeregningsGrunnlagRepository(
:dato_fom,
:dato_tom,
:utbetalt_beloep,
:har_foreldreloessats,
:trygdetid,
:trygdetid_for_ident,
:prorata_broek_teller,
Expand Down Expand Up @@ -275,6 +279,7 @@ private fun Row.asOverstyrBeregningGrunnlag(): OverstyrBeregningGrunnlagDao =
datoFOM = this.sqlDate("dato_fra_og_med").toLocalDate(),
datoTOM = this.sqlDateOrNull("dato_til_og_med")?.toLocalDate(),
utbetaltBeloep = this.longOrNull("utbetalt_beloep") ?: 0L,
foreldreloessats = this.anyOrNull("har_foreldreloessats")?.let { boolean("har_foreldreloessats") },
trygdetid = this.longOrNull("trygdetid") ?: 0,
trygdetidForIdent = stringOrNull("trygdetid_for_ident"),
prorataBroekTeller = this.longOrNull("prorata_broek_teller"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class BeregningsGrunnlagService(
data =
OverstyrBeregningGrunnlagData(
utbetaltBeloep = periode.utbetaltBeloep,
foreldreloessats = periode.foreldreloessats,
trygdetid = periode.trygdetid,
trygdetidForIdent = periode.trygdetidForIdent,
prorataBroekTeller = periode.prorataBroekTeller,
Expand Down Expand Up @@ -364,6 +365,7 @@ class BeregningsGrunnlagService(
datoFOM = it.fom,
datoTOM = it.tom,
utbetaltBeloep = it.data.utbetaltBeloep,
foreldreloessats = it.data.foreldreloessats,
trygdetid = it.data.trygdetid,
trygdetidForIdent = it.data.trygdetidForIdent,
prorataBroekTeller = it.data.prorataBroekTeller,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE overstyr_beregningsgrunnlag ADD COLUMN har_foreldreloessats BOOLEAN;
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ internal class BeregnOverstyrServiceTest {
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 123L,
trygdetid = 20L,
foreldreloessats = false,
trygdetidForIdent = null,
prorataBroekTeller = null,
prorataBroekNevner = null,
Expand All @@ -76,6 +77,7 @@ internal class BeregnOverstyrServiceTest {
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 456,
trygdetid = 10L,
foreldreloessats = false,
trygdetidForIdent = null,
prorataBroekTeller = null,
prorataBroekNevner = null,
Expand Down Expand Up @@ -111,6 +113,7 @@ internal class BeregnOverstyrServiceTest {
beregningsperioder.size shouldBeGreaterThanOrEqual 2
with(beregningsperioder.first()) {
utbetaltBeloep shouldBe 123
harForeldreloessats shouldBe false
datoFOM shouldBe behandling.virkningstidspunkt?.dato
datoTOM shouldBe YearMonth.of(2020, Month.APRIL)
grunnbelop shouldBe 99858
Expand Down Expand Up @@ -141,6 +144,7 @@ internal class BeregnOverstyrServiceTest {
GrunnlagMedPeriode(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 123L,
foreldreloessats = true,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = 10,
Expand All @@ -154,6 +158,7 @@ internal class BeregnOverstyrServiceTest {
GrunnlagMedPeriode(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 456,
foreldreloessats = true,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = 10,
Expand Down Expand Up @@ -190,6 +195,7 @@ internal class BeregnOverstyrServiceTest {
beregningsperioder.size shouldBeGreaterThanOrEqual 2
with(beregningsperioder.first()) {
utbetaltBeloep shouldBe 123
harForeldreloessats shouldBe true
datoFOM shouldBe behandling.virkningstidspunkt?.dato
datoTOM shouldBe YearMonth.of(2020, Month.APRIL)
grunnbelop shouldBe 99858
Expand Down Expand Up @@ -227,6 +233,7 @@ internal class BeregnOverstyrServiceTest {
GrunnlagMedPeriode(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 123L,
foreldreloessats = null,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -240,6 +247,7 @@ internal class BeregnOverstyrServiceTest {
GrunnlagMedPeriode(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 456,
foreldreloessats = null,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down Expand Up @@ -276,6 +284,7 @@ internal class BeregnOverstyrServiceTest {
beregningsperioder.size shouldBeGreaterThanOrEqual 2
with(beregningsperioder.first()) {
utbetaltBeloep shouldBe 123
harForeldreloessats shouldBe null
datoFOM shouldBe behandling.virkningstidspunkt?.dato
datoTOM shouldBe YearMonth.of(2020, Month.APRIL)
grunnbelop shouldBe 99858
Expand Down Expand Up @@ -313,6 +322,7 @@ internal class BeregnOverstyrServiceTest {
GrunnlagMedPeriode(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 123L,
foreldreloessats = null,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -326,6 +336,7 @@ internal class BeregnOverstyrServiceTest {
GrunnlagMedPeriode(
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 456,
foreldreloessats = null,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down Expand Up @@ -362,6 +373,7 @@ internal class BeregnOverstyrServiceTest {
beregningsperioder.size shouldBeGreaterThanOrEqual 2
with(beregningsperioder.first()) {
utbetaltBeloep shouldBe 0
harForeldreloessats shouldBe null
datoFOM shouldBe behandling.virkningstidspunkt?.dato
datoTOM shouldBe YearMonth.of(2020, Month.APRIL)
grunnbelop shouldBe 99858
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ internal class BeregningsGrunnlagRepositoryIntegrationTest(
datoFOM = LocalDate.now().minusYears(12),
datoTOM = LocalDate.now().minusYears(6),
utbetaltBeloep = 123L,
foreldreloessats = false,
trygdetid = 35L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -340,6 +341,7 @@ internal class BeregningsGrunnlagRepositoryIntegrationTest(
datoFOM = LocalDate.now().minusYears(6).plusDays(1),
datoTOM = LocalDate.now(),
utbetaltBeloep = 321L,
foreldreloessats = false,
trygdetid = 5L,
trygdetidForIdent = null,
prorataBroekTeller = 10,
Expand Down Expand Up @@ -387,6 +389,7 @@ internal class BeregningsGrunnlagRepositoryIntegrationTest(
datoFOM = LocalDate.now().minusYears(12),
datoTOM = LocalDate.now().minusYears(6),
utbetaltBeloep = 123L,
foreldreloessats = false,
trygdetid = 35L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -406,6 +409,7 @@ internal class BeregningsGrunnlagRepositoryIntegrationTest(
datoFOM = LocalDate.now().minusYears(6).plusDays(1),
datoTOM = LocalDate.now(),
utbetaltBeloep = 321L,
foreldreloessats = false,
trygdetid = 5L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -431,6 +435,7 @@ internal class BeregningsGrunnlagRepositoryIntegrationTest(
datoFOM = LocalDate.now().minusYears(12),
datoTOM = LocalDate.now().minusYears(6),
utbetaltBeloep = 223L,
foreldreloessats = false,
trygdetid = 35L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -450,6 +455,7 @@ internal class BeregningsGrunnlagRepositoryIntegrationTest(
datoFOM = LocalDate.now().minusYears(6).plusDays(1),
datoTOM = LocalDate.now(),
utbetaltBeloep = 322L,
foreldreloessats = false,
trygdetid = 5L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ internal class BeregningsGrunnlagRoutesTest {
datoFOM = LocalDate.now().minusYears(12L),
datoTOM = LocalDate.now().minusYears(6L),
utbetaltBeloep = 123L,
foreldreloessats = false,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -583,6 +584,7 @@ internal class BeregningsGrunnlagRoutesTest {
datoFOM = LocalDate.now().minusYears(6L),
datoTOM = null,
utbetaltBeloep = 456L,
foreldreloessats = false,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = 10,
Expand Down Expand Up @@ -675,6 +677,7 @@ internal class BeregningsGrunnlagRoutesTest {
datoFOM = LocalDate.now().minusYears(12L),
datoTOM = LocalDate.now().minusYears(6L),
utbetaltBeloep = 123L,
foreldreloessats = false,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -694,6 +697,7 @@ internal class BeregningsGrunnlagRoutesTest {
datoFOM = LocalDate.now().minusYears(6L),
datoTOM = null,
utbetaltBeloep = 456L,
foreldreloessats = false,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down Expand Up @@ -727,6 +731,7 @@ internal class BeregningsGrunnlagRoutesTest {
data =
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 123L,
foreldreloessats = false,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -741,6 +746,7 @@ internal class BeregningsGrunnlagRoutesTest {
data =
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 456L,
foreldreloessats = false,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ internal class BeregningsGrunnlagServiceTest {
datoFOM = LocalDate.now().minusYears(12L),
datoTOM = LocalDate.now().minusYears(6L),
utbetaltBeloep = 123L,
foreldreloessats = false,
trygdetid = 10L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand All @@ -715,6 +716,7 @@ internal class BeregningsGrunnlagServiceTest {
datoFOM = LocalDate.now().minusYears(6L),
datoTOM = null,
utbetaltBeloep = 456L,
foreldreloessats = false,
trygdetid = 20L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down Expand Up @@ -786,6 +788,7 @@ internal class BeregningsGrunnlagServiceTest {
data =
OverstyrBeregningGrunnlagData(
utbetaltBeloep = 12L,
foreldreloessats = false,
trygdetid = 25L,
trygdetidForIdent = null,
prorataBroekTeller = null,
Expand Down Expand Up @@ -1082,6 +1085,7 @@ internal class BeregningsGrunnlagServiceTest {
datoFOM = datoFOM,
datoTOM = datoTOM,
utbetaltBeloep = utbetaltBeloep,
foreldreloessats = false,
trygdetid = 0,
trygdetidForIdent = "",
prorataBroekTeller = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class RegulerOverstyrtKtTest {
datoFOM = LocalDate.of(2022, 5, 1),
datoTOM = null,
utbetaltBeloep = 5679,
foreldreloessats = false,
trygdetid = 40,
trygdetidForIdent = "",
prorataBroekTeller = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import React from 'react'
import { PeriodisertBeregningsgrunnlagDto } from '~components/behandling/beregningsgrunnlag/PeriodisertBeregningsgrunnlag'
import { OverstyrBeregningsperiode } from '~shared/types/Beregning'
import { BodyShort, Box, HStack, Label } from '@navikt/ds-react'
import { SakType } from '~shared/types/sak'

export const OverstyrBeregningsgrunnlagExpandableRowContent = ({
overtyrBeregningsgrunnlagPeriode,
sakType,
}: {
overtyrBeregningsgrunnlagPeriode: PeriodisertBeregningsgrunnlagDto<OverstyrBeregningsperiode>
sakType: SakType
}) => {
return (
<HStack gap="8">
Expand All @@ -22,6 +25,13 @@ export const OverstyrBeregningsgrunnlagExpandableRowContent = ({
<Label>Prorata brøk</Label>
<BodyShort>{`${overtyrBeregningsgrunnlagPeriode.data.prorataBroekTeller ?? '-'} / ${overtyrBeregningsgrunnlagPeriode.data.prorataBroekNevner ?? '-'}`}</BodyShort>
</div>
{sakType == SakType.BARNEPENSJON && (
<div>
<Label>Foreldreløssats</Label>
<BodyShort>{`${overtyrBeregningsgrunnlagPeriode.data.foreldreloessats ? 'Ja' : overtyrBeregningsgrunnlagPeriode.data.foreldreloessats === false ? 'Nei' : 'Ikke besvart'}`}</BodyShort>
</div>
)}

<Box maxWidth="7rem">
<Label>Beskrivelse</Label>
<BodyShort>{overtyrBeregningsgrunnlagPeriode.data.beskrivelse}</BodyShort>
Expand Down
Loading

0 comments on commit 4493f7f

Please sign in to comment.