Skip to content

Commit

Permalink
Sjekk for gjelderBarnReferanse i filtrering av grunnlag (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
ugur93 authored Feb 19, 2025
1 parent b752ef4 commit 7595604
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ fun List<BaseGrunnlag>.filtrerBasertPåEgenReferanser(

fun List<BaseGrunnlag>.filtrerBasertPåFremmedReferanse(
grunnlagType: Grunnlagstype? = null,
referanse: String = "",
referanse: String? = null,
gjelderBarnReferanse: String? = null,
): List<BaseGrunnlag> =
filter { grunnlagType == null || it.type == grunnlagType }
.filter {
referanse.isEmpty() ||
referanse.isNullOrEmpty() &&
gjelderBarnReferanse.isNullOrEmpty() ||
it.grunnlagsreferanseListe.contains(referanse) ||
referanse == it.gjelderReferanse ||
referanse == it.gjelderBarnReferanse
(referanse.isNullOrEmpty() || referanse == it.gjelderReferanse) &&
(gjelderBarnReferanse.isNullOrEmpty() || gjelderBarnReferanse == it.gjelderBarnReferanse)
}

fun List<BaseGrunnlag>.filtrerBasertPåEgenReferanse(
Expand Down Expand Up @@ -125,9 +127,10 @@ inline fun <reified T : GrunnlagInnhold> List<BaseGrunnlag>.filtrerOgKonverterBa

inline fun <reified T : GrunnlagInnhold> List<BaseGrunnlag>.filtrerOgKonverterBasertPåFremmedReferanse(
grunnlagType: Grunnlagstype? = null,
referanse: String = "",
referanse: String? = null,
gjelderBarnReferanse: String? = null,
): List<InnholdMedReferanse<T>> =
filtrerBasertPåFremmedReferanse(grunnlagType, referanse)
filtrerBasertPåFremmedReferanse(grunnlagType, referanse, gjelderBarnReferanse)
.map {
it.tilInnholdMedReferanse<T>()
}
Expand Down

0 comments on commit 7595604

Please sign in to comment.