From 99c38b2dca62b6dae10e3a54a24e2791d80e4cb6 Mon Sep 17 00:00:00 2001 From: AudunSorheim Date: Tue, 24 Oct 2023 14:26:18 +0200 Subject: [PATCH] Update query --- .../kotlin/no/nav/syfo/persistence/AktivitetskravDAO.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/no/nav/syfo/persistence/AktivitetskravDAO.kt b/src/main/kotlin/no/nav/syfo/persistence/AktivitetskravDAO.kt index dae6849..0729965 100644 --- a/src/main/kotlin/no/nav/syfo/persistence/AktivitetskravDAO.kt +++ b/src/main/kotlin/no/nav/syfo/persistence/AktivitetskravDAO.kt @@ -95,11 +95,10 @@ class AktivitetskravDAO(val namedParameterJdbcTemplate: NamedParameterJdbcTempla fun getAktivitetsplikt(fnr: String): Aktivitetsplikt? { val query = """ - SELECT vurdering.status, vurdering.arsaker, vurdering.sist_vurdert, vurdering.frist, varsel.journalpost_id + SELECT vurdering.status, vurdering.arsaker, vurdering.sist_vurdert, vurdering.frist, varsel.journalpost_id FROM aktivitetskrav_vurdering vurdering - LEFT JOIN aktivitetskrav_varsel varsel ON vurdering.person_ident = varsel.person_ident - WHERE varsel.person_ident = :person_ident - AND varsel.aktivitetskrav_uuid = vurdering.vurdering_uuid + LEFT JOIN aktivitetskrav_varsel varsel ON vurdering.siste_vurdering_uuid = varsel.vurdering_uuid + WHERE vurdering.person_ident = :person_ident ORDER BY vurdering.created_at desc, vurdering.sist_vurdert desc NULLS LAST LIMIT 1; """.trimIndent()