Skip to content

Commit

Permalink
🐛 Det er den transaksjonelle daoen som må hente aktiv eller opprette
Browse files Browse the repository at this point in the history
  • Loading branch information
chsko committed Oct 21, 2024
1 parent 960bc8a commit 9b9ccd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class TotrinnsvurderingDao(private val dataSource: DataSource) : Totrinnsvurderi
override fun opprett(vedtaksperiodeId: UUID): TotrinnsvurderingOld =
sessionOf(dataSource).use { session ->
session.transaction { transaction ->
val transactionalDao = TransactionalTotrinnsvurderingDao(transaction)
transactionalDao.hentAktiv(vedtaksperiodeId) ?: transactionalDao.opprett(vedtaksperiodeId)
TransactionalTotrinnsvurderingDao(transaction).opprett(vedtaksperiodeId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ internal class TransactionalTotrinnsvurderingDao(
}

override fun opprett(vedtaksperiodeId: UUID): TotrinnsvurderingOld {
return hentAktiv(vedtaksperiodeId) ?: opprettTotrinnsvurdering(vedtaksperiodeId)
}

private fun opprettTotrinnsvurdering(vedtaksperiodeId: UUID): TotrinnsvurderingOld {
@Language("PostgreSQL")
val query =
"""
Expand Down

0 comments on commit 9b9ccd8

Please sign in to comment.