Skip to content

Commit

Permalink
fix: dueDate is nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceh121 committed Nov 30, 2023
1 parent c2c52ce commit cace2b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/me/vinceh121/knb/SkolengoCheckingJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ private void processHomework(final Knb knb, final JSkolengo sko, final StudentUs
try {
hws = sko.fetchHomeworkAssignments(LocalDate.now().minusWeeks(1), LocalDate.now().plusWeeks(1))
.stream()
.filter(hw -> hw.getDueDate().isAfter(LocalDate.now()))
.filter(hw -> redis.exists(HOMEWORK_REDIS_PREFIX + hw.getId()))
.collect(Collectors.toList());
} catch (final Exception e) {
Expand All @@ -286,13 +285,14 @@ private void processHomework(final Knb knb, final JSkolengo sko, final StudentUs
redis.set(HOMEWORK_REDIS_PREFIX + hw.getId(), "",
SetParams.setParams()
.nx()
.exAt(hw.getDueDate().plusDays(1).atStartOfDay().toEpochSecond(ZoneOffset.UTC)));
.exAt(LocalDate.now().plusWeeks(4).atStartOfDay().toEpochSecond(ZoneOffset.UTC)));
}

final String estabName = info.getSchool().getName();

final LocalDate oldest
= Collections.min(hws, (o1, o2) -> o1.getDueDate().compareTo(o2.getDueDate())).getDueDate();
= Collections.min(hws, (o1, o2) -> o1.getDueDate() == null || o2.getDueDate() == null ? -1
: o1.getDueDate().compareTo(o2.getDueDate())).getDueDate();

final EmbedBuilder embBuild = new EmbedBuilder();

Expand Down

0 comments on commit cace2b1

Please sign in to comment.