Skip to content

Commit

Permalink
♻️ Bruk pipe og hjelpefunksjon i 20ProsentTotalGrad-funksjon
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMekk committed Dec 19, 2024
1 parent 5ef0d7b commit e2a1a2d
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ export const harPeriodeDagerMedUnder20ProsentTotalGrad = (
R.filter((it) => overlapper(it)(periode)),
);

return alleOverlappendePerioderPåSkjæringstidspunkt
.flatMap((it) => it.tidslinje)
.filter((it) => dayjs(it.dato, ISO_DATOFORMAT).isBetween(periode.fom, periode.tom, 'day', '[]'))
.filter((dag) => dag?.sykdomsdagtype === 'SYKEDAG')
.some((dag) => (dag?.utbetalingsinfo?.totalGrad ?? 100) < 20);
return R.pipe(
alleOverlappendePerioderPåSkjæringstidspunkt,
R.flatMap((it) => it.tidslinje),
R.filter((it) => erIPeriode(it.dato, periode)),
R.filter((dag) => dag?.sykdomsdagtype === 'SYKEDAG'),
).some((dag) => (dag?.utbetalingsinfo?.totalGrad ?? 100) < 20);
};

const kappOverlappendePerioder = (
Expand Down

0 comments on commit e2a1a2d

Please sign in to comment.