Skip to content

Commit

Permalink
Expand shift groups with unconfirmed shifts (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
frimtec authored Feb 14, 2024
1 parent 5efdab3 commit 17e9e6f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,22 @@ protected Set<Integer> getExpandedGroups() {
.filter(yearToPosition::containsKey)
.map(yearToPosition::get)
.collect(Collectors.toCollection(HashSet::new));
expandedGroups.addAll(
IntStream.range(0, getGroupCount())
.boxed()
.filter(i -> hasUnconfirmedShifts(getGroup(i).items()))
.collect(Collectors.toCollection(HashSet::new))
);
if (getGroupCount() > 0) {
expandedGroups.add(0);
}
return expandedGroups;
}

private boolean hasUnconfirmedShifts(List<? extends Shift> shifts) {
return shifts.stream().anyMatch(shift -> !shift.isConfirmed());
}

@Override
protected AbstractExpandableListAdapter<YearMonth, Shift> createAdapter() {
List<Shift> shifts;
Expand Down

0 comments on commit 17e9e6f

Please sign in to comment.