Skip to content

Commit ed3fc8b

Browse files
committedMar 4, 2024·
Fix filter condition in getIverksatteInnvilgedeSøknader function
1 parent 3306bdd commit ed3fc8b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/utils/søknad/søknadUtils.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ export function getIverksatteInnvilgedeSøknader(sak: Sak) {
5353
);
5454
})
5555
.map((s) => {
56-
const behandling = sak.behandlinger.filter((b) => b.status === SøknadsbehandlingStatus.IVERKSATT_INNVILGET);
56+
const behandling = sak.behandlinger.filter(
57+
(b) => b.søknad.id === s.id && b.status === SøknadsbehandlingStatus.IVERKSATT_INNVILGET,
58+
);
5759

5860
if (behandling.length !== 1) {
59-
throw new Error('Forventet at en søknad kun av 1 iverksatt innvilget behandling');
61+
throw new Error('Forventet at en søknad kun har 1 iverksatt innvilget behandling');
6062
}
6163

6264
const vedtakForBehandling = sak.vedtak.find((v) => v.behandlingId === behandling[0].id);

0 commit comments

Comments
 (0)
Please sign in to comment.