-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bytt til tidslinjebibliotek fra familie-felles (#5102)
### 💰 Hva skal gjøres, og hvorfor? Favro: NAV-23270 Fortsettelse av #5099 Bytter ut tidslinje fra ba-sak med tidslinje fra familie-felles enkelte steder. Holder PR'ene små, så de skal være lette å lese. Bør leses commit for commit. Det er noe duplikatkode, men dette vil fjernes i senere PR'er
- Loading branch information
1 parent
215a038
commit 0b3cff6
Showing
15 changed files
with
123 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 12 additions & 15 deletions
27
src/main/kotlin/no/nav/familie/ba/sak/kjerne/beregning/EndretUtbetalingAndelTidslinje.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
package no.nav.familie.ba.sak.kjerne.beregning | ||
|
||
import no.nav.familie.ba.sak.common.Feil | ||
import no.nav.familie.ba.sak.common.førsteDagIInneværendeMåned | ||
import no.nav.familie.ba.sak.common.sisteDagIInneværendeMåned | ||
import no.nav.familie.ba.sak.kjerne.endretutbetaling.domene.EndretUtbetalingAndel | ||
import no.nav.familie.ba.sak.kjerne.tidslinje.Periode | ||
import no.nav.familie.ba.sak.kjerne.tidslinje.Tidslinje | ||
import no.nav.familie.ba.sak.kjerne.tidslinje.tidspunkt.Måned | ||
import no.nav.familie.ba.sak.kjerne.tidslinje.tidspunkt.MånedTidspunkt.Companion.tilTidspunkt | ||
import no.nav.familie.tidslinje.Periode | ||
import no.nav.familie.tidslinje.Tidslinje | ||
import no.nav.familie.tidslinje.tilTidslinje | ||
|
||
class EndretUtbetalingAndelTidslinje( | ||
private val endretUtbetalingAndeler: List<EndretUtbetalingAndel>, | ||
) : Tidslinje<EndretUtbetalingAndel, Måned>() { | ||
override fun lagPerioder(): Collection<Periode<EndretUtbetalingAndel, Måned>> = | ||
endretUtbetalingAndeler.map { | ||
fun List<EndretUtbetalingAndel>.tilTidslinje(): Tidslinje<EndretUtbetalingAndel> = | ||
this | ||
.map { | ||
Periode( | ||
fraOgMed = it.fom?.tilTidspunkt() ?: throw Feil("Endret utbetaling andel har ingen fom-dato: $it"), | ||
tilOgMed = it.tom?.tilTidspunkt() ?: throw Feil("Endret utbetaling andel har ingen tom-dato: $it"), | ||
innhold = it, | ||
verdi = it, | ||
fom = it.fom?.førsteDagIInneværendeMåned(), | ||
tom = it.tom?.sisteDagIInneværendeMåned(), | ||
) | ||
} | ||
} | ||
}.tilTidslinje() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
...otlin/no/nav/familie/ba/sak/kjerne/forrigebehandling/EndringIEndretUtbetalingAndelUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
src/main/kotlin/no/nav/familie/ba/sak/kjerne/forrigebehandling/EndringUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
package no.nav.familie.ba.sak.kjerne.forrigebehandling | ||
|
||
import no.nav.familie.ba.sak.kjerne.tidslinje.Tidslinje | ||
import no.nav.familie.ba.sak.kjerne.tidslinje.tidspunkt.Måned | ||
import no.nav.familie.ba.sak.kjerne.tidslinje.tidspunkt.tilYearMonth | ||
import no.nav.familie.ba.sak.common.toYearMonth | ||
import no.nav.familie.tidslinje.Tidslinje | ||
import no.nav.familie.tidslinje.utvidelser.tilPerioder | ||
|
||
object EndringUtil { | ||
internal fun Tidslinje<Boolean, Måned>.tilFørsteEndringstidspunkt() = | ||
internal fun Tidslinje<Boolean>.tilFørsteEndringstidspunkt() = | ||
this | ||
.perioder() | ||
.filter { it.innhold == true } | ||
.minOfOrNull { it.fraOgMed } | ||
?.tilYearMonth() | ||
.tilPerioder() | ||
.filter { it.verdi == true } | ||
.mapNotNull { it.fom } | ||
.minOfOrNull { it } | ||
?.toYearMonth() | ||
} |
Oops, something went wrong.