From 91afc5ed3dbe432b3382c80289d29c9f441c037b Mon Sep 17 00:00:00 2001 From: Hama Keli Date: Fri, 21 Jun 2024 10:29:48 +0200 Subject: [PATCH 1/3] =?UTF-8?q?ORG-1799:=20Skjuler=20n=C3=A5=20sluttdatoen?= =?UTF-8?q?=20p=C3=A5=20ansatte=20hvor=20sluttdato=20er=20f=C3=B8r=20dagen?= =?UTF-8?q?sdato.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nav/data/team/member/MemberExportService.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java b/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java index 5dc48bd34..69da578f1 100644 --- a/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java +++ b/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java @@ -12,18 +12,21 @@ import no.nav.data.team.po.ProductAreaService; import no.nav.data.team.po.domain.ProductArea; import no.nav.data.team.resource.NomGraphClient; +import no.nav.data.team.resource.domain.ResourceType; import no.nav.data.team.shared.Lang; import no.nav.data.team.shared.domain.Membered; import no.nav.data.team.team.TeamService; import no.nav.data.team.team.domain.Team; import org.springframework.stereotype.Service; +import java.time.LocalDate; import java.util.Comparator; import java.util.List; import java.util.UUID; import java.util.stream.Stream; import static java.util.Comparator.comparing; +import static java.util.Objects.isNull; import static java.util.Optional.ofNullable; import static java.util.stream.Collectors.toList; import static no.nav.data.common.utils.StreamUtils.convert; @@ -149,10 +152,15 @@ private void add(ExcelBuilder doc, Member member) { .addCell(member.member.getDescription()) .addCell(member.member.getResource().getEmail()) .addCell(DateUtil.formatDate(member.member.getResource().getStartDate())) - .addCell(DateUtil.formatDate(member.member.getResource().getEndDate())) + .addCell(shouldHideEndDateIfBeforeNow(member.member.getResource().getEndDate())) ; } + private String shouldHideEndDateIfBeforeNow(LocalDate endDate) { + if (isNull(endDate) || endDate.isBefore(LocalDate.now())) return null; + else return DateUtil.formatDate(endDate); + } + record Member(Relation relation, MemberResponse member, Team team, ProductArea pa, List clusters) { enum Relation { @@ -196,8 +204,5 @@ public String memberType() { public String roles() { return String.join(", ", convert(member.getRoles(), Lang::roleName)); } - - } - } From 3ee8147da9c6086b5b71b20df1892bea5dc84ff0 Mon Sep 17 00:00:00 2001 From: Hama Keli Date: Fri, 21 Jun 2024 10:30:42 +0200 Subject: [PATCH 2/3] =?UTF-8?q?ORG-1799:=20Skjuler=20n=C3=A5=20sluttdatoen?= =?UTF-8?q?=20p=C3=A5=20responsen=20hvis=20sluttdato=20ikke=20er=20f=C3=B8?= =?UTF-8?q?r=20dagens=20dato.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/no/nav/data/team/resource/domain/Resource.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java b/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java index fed26b889..44c12d2f1 100644 --- a/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java +++ b/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java @@ -19,6 +19,8 @@ import java.time.ZonedDateTime; import java.util.UUID; +import static java.util.Objects.isNull; + @Data @Builder @AllArgsConstructor @@ -90,9 +92,14 @@ public ResourceResponse convertToResponse() { .onLeave(onLeave) .resourceType(resourceType) .startDate(startDate) - .endDate(endDate) + .endDate(shouldHideEndDateIfBeforeNow()) .stale(stale) .links(Links.getFor(this)) .build(); } + + private LocalDate shouldHideEndDateIfBeforeNow() { + if (isNull(this.endDate) || this.endDate.isBefore(LocalDate.now())) return null; + else return this.endDate; + } } From bfd5aa77d6efa8007f044a89e86d13390ca931c2 Mon Sep 17 00:00:00 2001 From: Hama Keli Date: Fri, 21 Jun 2024 10:42:40 +0200 Subject: [PATCH 3/3] ORG-1799: Fjernet en import som ikke ble brukt likevel --- .../main/java/no/nav/data/team/member/MemberExportService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java b/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java index 69da578f1..5bd55a7f2 100644 --- a/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java +++ b/apps/backend/src/main/java/no/nav/data/team/member/MemberExportService.java @@ -12,7 +12,6 @@ import no.nav.data.team.po.ProductAreaService; import no.nav.data.team.po.domain.ProductArea; import no.nav.data.team.resource.NomGraphClient; -import no.nav.data.team.resource.domain.ResourceType; import no.nav.data.team.shared.Lang; import no.nav.data.team.shared.domain.Membered; import no.nav.data.team.team.TeamService;