Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Commit

Permalink
Fixed selection of voting results for a specific day thus enabling di…
Browse files Browse the repository at this point in the history
…splay of the voting results of the current day. (#40)
  • Loading branch information
mklaehn authored Oct 2, 2023
1 parent 43f8025 commit eb322da
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,18 @@ public List<RatedTalk> getRatedTalks(final String conferenceDay) {
LOG.debug("######## randomizedRatedTalksPerDay");
return randomizedRatedTalks();
} else {
return getVotingResults().entrySet().stream()
.filter(e -> e.getKey().dayId().equals(conferenceDay))
.map(Map.Entry::getValue)
.findFirst()
.orElse(List.of());
final Map<WeekDay, List<RatedTalk>> votingResults = getVotingResults();

return votingResults.entrySet().stream()
.filter(e -> e.getKey().dayId().equals(conferenceDay))
.map(Map.Entry::getValue)
.findFirst()
.orElseGet(() -> {
LOG.warn(
"Lookup of voting results for conferenceDay='{}' failed among the following keySet: {}",
conferenceDay, votingResults.keySet());
return List.of();
});
}
}

Expand Down Expand Up @@ -419,7 +426,9 @@ private static <T> T alternatives(final T... ts) {
protected static record WeekDay(String dayId) {

static WeekDay of(String date) {
return new WeekDay(LocalDate.parse(date).getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.ENGLISH));
return new WeekDay(LocalDate.parse(date).getDayOfWeek()
.getDisplayName(TextStyle.FULL, Locale.ENGLISH)
.toLowerCase(Locale.ENGLISH));
}
}
}

0 comments on commit eb322da

Please sign in to comment.