When end is null (last gap) add 10 years from now

This commit is contained in:
Diego Pino Garcia 2010-12-23 11:12:07 +01:00
parent 93d34a6a9d
commit 9dbcf0c006
2 changed files with 8 additions and 2 deletions

View file

@ -46,6 +46,13 @@ public class DateAndHour implements Comparable<DateAndHour> {
return new DateAndHour(date.getDate(), date.getEffortDuration().getHours());
}
public static DateAndHour TEN_YEARS_FROM(DateAndHour dateAndHour) {
LocalDate date = dateAndHour.getDate() != null ? dateAndHour.getDate() : new LocalDate();
DateAndHour result = new DateAndHour(date, dateAndHour.getHour());
result.plusYears(10);
return result;
}
private LocalDate date;
private Integer hour;

View file

@ -175,8 +175,7 @@ public class Gap implements Comparable<Gap> {
// If endTime is null (last tasks) assume the end is in 10 years from now
DateAndHour endDate = getEndTime();
if (endDate == null) {
endDate = new DateAndHour(realStart);
endDate.plusYears(10);
endDate = DateAndHour.TEN_YEARS_FROM(realStart);
}
Iterator<PartialDay> daysUntilEnd = realStart.toIntraDayDate()