}
}
public YearMonthDay getNextPossibleSummaryDate() {
YearMonthDay currentDate = new YearMonthDay();
HourMinuteSecond now = new HourMinuteSecond();
Summary lastSummary = getLastSummary();
if (lastSummary != null) {
SortedSet<YearMonthDay> datesEvenToday = getAllLessonDatesUntil(currentDate);
SortedSet<YearMonthDay> possibleDates = datesEvenToday.tailSet(lastSummary.getSummaryDateYearMonthDay());
possibleDates.remove(lastSummary.getSummaryDateYearMonthDay());
if (!possibleDates.isEmpty()) {
YearMonthDay nextPossibleDate = possibleDates.first();
return isTimeValidToInsertSummary(now, nextPossibleDate) ? nextPossibleDate : null;
}
} else {
YearMonthDay nextPossibleDate = hasAnyLessonInstances() ? getFirstLessonInstance().getDay() : getLessonStartDay();
return isTimeValidToInsertSummary(now, nextPossibleDate) ? nextPossibleDate : null;
}
return null;
}