Skip to content

Commit

Permalink
Fjerner duplikate hendelser fra behandingprosesseventk9 i utlesing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tendestad authored Jun 29, 2024
1 parent 56c3262 commit 76d09c5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BehandlingProsessEventK9Repository(private val dataSource: DataSource) {
}
val modell = LosObjectMapper.instance.readValue(json, K9SakModell::class.java)

return K9SakModell(modell.eventer.sortedBy { it.eventTid }.toMutableList())
return K9SakModell(modell.eventer.distinct().sortedBy { it.eventTid }.toMutableList())
}

fun hentMedLås(tx: TransactionalSession, uuid: UUID): K9SakModell {
Expand All @@ -54,7 +54,7 @@ class BehandlingProsessEventK9Repository(private val dataSource: DataSource) {
}
val modell = LosObjectMapper.instance.readValue(json, K9SakModell::class.java)

return K9SakModell(modell.eventer.sortedBy { it.eventTid }.toMutableList())
return K9SakModell(modell.eventer.distinct().sortedBy { it.eventTid }.toMutableList())
}

fun fjernDirty(uuid: UUID, tx: TransactionalSession) {
Expand Down Expand Up @@ -93,12 +93,12 @@ class BehandlingProsessEventK9Repository(private val dataSource: DataSource) {

val modell = if (!run.isNullOrEmpty()) {
val modell = LosObjectMapper.instance.readValue(run, K9SakModell::class.java)
f(modell.copy(eventer = modell.eventer.sortedBy { it.eventTid }.toMutableList()))
f(modell.copy(eventer = modell.eventer.distinct().sortedBy { it.eventTid }.toMutableList()))
} else {
f(null)
}
sortertModell =
modell.copy(eventer = (modell.eventer.toSet().toList().sortedBy { it.eventTid }.toMutableList()))
modell.copy(eventer = (modell.eventer.distinct().sortedBy { it.eventTid }.toMutableList()))
val json = LosObjectMapper.instance.writeValueAsString(sortertModell)
tx.run(
queryOf(
Expand Down

0 comments on commit 76d09c5

Please sign in to comment.