Skip to content

Commit

Permalink
Endret til abs. for daysBetweenNow
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsmsa committed Sep 23, 2024
1 parent 12b3037 commit 46de411
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import no.nav.paw.arbeidssokerregisteret.application.opplysninger.DomeneOpplysni
import no.nav.paw.arbeidssokerregisteret.application.opplysninger.Opplysning
import java.time.LocalDate
import java.time.temporal.ChronoUnit
import kotlin.math.absoluteValue

data class StatsOppholdtilatelse(
val fra: LocalDate?,
Expand Down Expand Up @@ -43,7 +44,7 @@ fun PrometheusMeterRegistry.oppholdstillatelseStats(oppholdtilatelse: StatsOppho
opplysninger.contains(DomeneOpplysning.ErNorskStatsborger).toString()
)
) + opplysningerTags(opplysninger)
counter("paw_bosatt_vs_oppholds_stats_v1", tags).increment()
counter("paw_bosatt_vs_oppholds_stats_v2", tags).increment()
}

fun opplysningerTags(opplysninger: Collection<Opplysning>): Collection<Tag> =
Expand All @@ -59,7 +60,7 @@ fun opplysningerTags(opplysninger: Collection<Opplysning>): Collection<Tag> =

fun daysBetweenNow(then: LocalDate): Long {
val now = LocalDate.now()
return ChronoUnit.DAYS.between(now, then)
return ChronoUnit.DAYS.between(now, then).absoluteValue
}

fun asBucket(number: Long): String =
Expand Down

0 comments on commit 46de411

Please sign in to comment.