Skip to content

Commit

Permalink
Endret fra Java-stil til Kotlin-stil for Duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Kroken committed Oct 4, 2023
1 parent 949b909 commit 005da3a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.
import no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.repository.BarnetrygdInnlesingRepository
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.time.Duration
import java.time.Instant.now
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.hours
import kotlin.time.toJavaDuration

@Service
class StatusService(
Expand All @@ -23,14 +25,14 @@ class StatusService(
}

private fun ikkeProsessert(innlesing: BarnetrygdInnlesing): Boolean {
val maksProsesseringsTid = now().minus(Duration.ofHours(2))
val maksProsesseringsTid = now().minus(2.hours.toJavaDuration())
val burdeVærtProsessert = innlesing.forespurtTidspunkt < maksProsesseringsTid
val erIkkeProsessert = innlesing.ferdigTidspunkt != null
return burdeVærtProsessert || erIkkeProsessert
}

private fun forGammel(innlesing: BarnetrygdInnlesing): Boolean {
val minimumTidspunkt = now().minus(Duration.ofDays(400))
val minimumTidspunkt = now().minus(400.days.toJavaDuration())
return innlesing.forespurtTidspunkt < minimumTidspunkt
}
}
Expand Down

0 comments on commit 005da3a

Please sign in to comment.