-
Notifications
You must be signed in to change notification settings - Fork 2
feat. filter for å skjule mentor avtaler med opphav arena #1434
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
base: master
Are you sure you want to change the base?
Changes from all commits
89e6909
425d462
7a841f5
c90bf04
aaf8a1f
0b814c6
37d14ce
7e50a3f
a7192aa
2d8b16e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -811,6 +811,25 @@ void sjekkOmAltErKlarTilGodkjenning() { | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public boolean sjekkOmAlltErFylltUtUntattFamiljeTilknyting() { | ||||||||||
|
||||||||||
|
|
||||||||||
| if (!felterSomIkkeErFyltUt().stream().filter(x -> !x.equals("harFamilietilknytning")).toList().isEmpty()) { | ||||||||||
|
||||||||||
| if (!felterSomIkkeErFyltUt().stream().filter(x -> !x.equals("harFamilietilknytning")).toList().isEmpty()) { | |
| if (felterSomIkkeErFyltUt().stream().anyMatch(x -> !x.equals("harFamilietilknytning"))) { |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new method sjekkOmAlltErFylltUtUntattFamiljeTilknyting() lacks test coverage. Consider adding tests to verify:
- Returns true when all fields are filled except "harFamilietilknytning"
- Returns false when any other field besides "harFamilietilknytning" is not filled
- Returns true when all fields including "harFamilietilknytning" are filled
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is a simple wrapper that adds no additional logic or documentation. Consider removing it and directly calling sjekkOmAlltErFylltUtUntattFamiljeTilknyting() from the caller in Avtalepart.java line 237, or add documentation explaining why this wrapper exists.
| public boolean erKlarForVisningAvMigrertMentorAvtale() { | |
| return sjekkOmAlltErFylltUtUntattFamiljeTilknyting(); | |
| } | |
| // Method removed: erKlarForVisningAvMigrertMentorAvtale() |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -69,6 +69,7 @@ protected final Page<Avtale> hentAvtalerMedLesetilgang( | |||||||||||||||||||||||||||||
| .stream() | ||||||||||||||||||||||||||||||
| .filter(this::avtalenEksisterer) | ||||||||||||||||||||||||||||||
| .filter(this.harTilgangTilAvtale(avtaler.getContent())) | ||||||||||||||||||||||||||||||
| .filter(this::mentorAvtaleUnderMigreringSkalVises) | ||||||||||||||||||||||||||||||
| .toList(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (queryParametre.erSokPaEnkeltperson() && avtalerMedTilgang.isEmpty()) { | ||||||||||||||||||||||||||||||
|
|
@@ -114,6 +115,10 @@ public void sjekkTilgang(Avtale avtale) { | |||||||||||||||||||||||||||||
| if (!avtalenEksisterer(avtale)) { | ||||||||||||||||||||||||||||||
| throw new RessursFinnesIkkeException(); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| if (!mentorAvtaleUnderMigreringSkalVises(avtale)) { | ||||||||||||||||||||||||||||||
| log.info("Forsøk på tilgang til skjult mentoravtale med opphav Arena for migrering. AvtaleNr: {}", avtale.getAvtaleNr()); | ||||||||||||||||||||||||||||||
| throw new RessursFinnesIkkeException(); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| if (harTilgangTilAvtale(avtale) instanceof Tilgang.Avvis avvis) { | ||||||||||||||||||||||||||||||
| switch (avvis.tilgangskode()) { | ||||||||||||||||||||||||||||||
| case STRENGT_FORTROLIG_ADRESSE -> throw new IkkeTilgangTilDeltakerException( | ||||||||||||||||||||||||||||||
|
|
@@ -214,4 +219,27 @@ public void settLonntilskuddProsentsats(Avtale avtale) { | |||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| private boolean erAvtaleMigrertMentorArena(Avtale avtale) { | ||||||||||||||||||||||||||||||
| return avtale.getTiltakstype() == Tiltakstype.MENTOR | ||||||||||||||||||||||||||||||
| && avtale.getOpphav() == Avtaleopphav.ARENA; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| private boolean mentorAvtaleUnderMigreringSkalVises(Avtale avtale) { | ||||||||||||||||||||||||||||||
| boolean erMentorArena = erAvtaleMigrertMentorArena(avtale); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (!erMentorArena) { | ||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| boolean erInternRolle = rolle().erInternBruker(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| boolean utFylltUntattFamiljeTilknyting = avtale.erKlarForVisningAvMigrertMentorAvtale(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (!erInternRolle && !utFylltUntattFamiljeTilknyting) { | ||||||||||||||||||||||||||||||
| log.info("Skjult mentoravtale med opphav Arena for migrering. Rolle: {}, AvtaleNr: {}", rolle(), avtale.getAvtaleNr()); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| return erInternRolle || utFylltUntattFamiljeTilknyting; | ||||||||||||||||||||||||||||||
|
Comment on lines
+237
to
+243
|
||||||||||||||||||||||||||||||
| boolean utFylltUntattFamiljeTilknyting = avtale.erKlarForVisningAvMigrertMentorAvtale(); | |
| if (!erInternRolle && !utFylltUntattFamiljeTilknyting) { | |
| log.info("Skjult mentoravtale med opphav Arena for migrering. Rolle: {}, AvtaleNr: {}", rolle(), avtale.getAvtaleNr()); | |
| } | |
| return erInternRolle || utFylltUntattFamiljeTilknyting; | |
| boolean utfyltUntattFamilietilknytning = avtale.erKlarForVisningAvMigrertMentorAvtale(); | |
| if (!erInternRolle && !utfyltUntattFamilietilknytning) { | |
| log.info("Skjult mentoravtale med opphav Arena for migrering. Rolle: {}, AvtaleNr: {}", rolle(), avtale.getAvtaleNr()); | |
| } | |
| return erInternRolle || utfyltUntattFamilietilknytning; |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new filtering logic for migrated mentor agreements from Arena lacks test coverage. Consider adding tests for:
- Non-internal users being denied access to incomplete migrated mentor agreements
- Internal users (VEILEDER/BESLUTTER) having access to all migrated mentor agreements
- Non-internal users having access to completed migrated mentor agreements
- Non-mentor or non-Arena agreements not being affected by the filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removed
avtalenEksistereroverride previously hid ALL Arena agreements that weren't concluded (!erAvtaleInngått()) from employers. The new filtering logic inAvtalepartonly hides MENTOR Arena agreements based on completion status. This means non-mentor Arena agreements that aren't concluded will now be visible to employers. If this behavior change is intentional, consider documenting it; otherwise, the old logic may need to be preserved or combined with the new filter.