Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samle logikk for utsatt oppgave i service #374

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bjerga
Copy link
Contributor

@bjerga bjerga commented Jul 7, 2022

No description provided.

private val logger = this.logger()

fun opprettOppgaveIGosys(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denne er bare flyttet på, men noen småforbedringer som ikke endrer funksjonalitet.

Comment on lines -43 to -44
if (oppgave.timeout == null) {
metrikk.tellUtsattOppgave_UtenDato()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sletter denne, da den aldri til oppstå. timeout er ikke nullable. Fjerner også tellUtsattOppgave_UtenDato-metrikken, da den kun ble brukt her.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout ER jo nullable:

class OppgaveOppdatering(
val id: UUID,
val handling: Handling,
val timeout: LocalDateTime?,
val oppdateringstype: OppdateringstypeDTO
)

if (oppgave.tilstand == Tilstand.Utsatt && oppdatering.handling == no.nav.syfo.utsattoppgave.Handling.Utsett) {
if (oppgave.timeout == null) {
metrikk.tellUtsattOppgave_UtenDato()
return when {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Her bytter jeg bare if-ene med en when, og bruker piping der det føles naturlig.

Comment on lines +92 to +100
oppgave
.apply {
oppdatert = LocalDateTime.now()
}
.copy(
tilstand = Tilstand.Forkastet,
speil = gjelderSpeil,
)
.lagre()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeg forstår ikke helt hvorfor oppgave blir muterer oppdatert-feltet, for så å bruke den ikke-muterende copy-funksjonen 🤷

@bjerga bjerga marked this pull request as ready for review July 7, 2022 08:55
@bjerga bjerga requested a review from a team as a code owner July 7, 2022 08:55
@sonarcloud
Copy link

sonarcloud bot commented Jul 8, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

0.0% 0.0% Coverage
0.4% 0.4% Duplication

Copy link
Contributor

@laukvik laukvik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout er satt som optional. Kan ikke godkjenne denne da...

Comment on lines -43 to -44
if (oppgave.timeout == null) {
metrikk.tellUtsattOppgave_UtenDato()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout ER jo nullable:

class OppgaveOppdatering(
val id: UUID,
val handling: Handling,
val timeout: LocalDateTime?,
val oppdateringstype: OppdateringstypeDTO
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants