Skip to content

Commit

Permalink
ORG-1799: Skjuler nå sluttdatoen på ansatte hvor sluttdato er før dag…
Browse files Browse the repository at this point in the history
…ensdato.
  • Loading branch information
hamkel committed Jun 21, 2024
1 parent d585991 commit 91afc5e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Cluster> clusters) {

enum Relation {
Expand Down Expand Up @@ -196,8 +204,5 @@ public String memberType() {
public String roles() {
return String.join(", ", convert(member.getRoles(), Lang::roleName));
}


}

}

0 comments on commit 91afc5e

Please sign in to comment.