Merge pull request #82 from schrom01/fix_tasklist_filteringPastTasks
Fix tasklist filtering past tasks
This commit is contained in:
commit
807a9017ad
|
@ -176,13 +176,10 @@ public class GardenSchedule {
|
||||||
dayTaskList.add(new ArrayList<>());
|
dayTaskList.add(new ArrayList<>());
|
||||||
final int finalI = i;
|
final int finalI = i;
|
||||||
weekTasks.forEach(task -> {
|
weekTasks.forEach(task -> {
|
||||||
if (task.getNextExecution() == null) {
|
if(task.getNextExecution() != null) {
|
||||||
task.isDone();
|
|
||||||
} else {
|
|
||||||
LocalDate checkDate = task.getNextExecution();
|
LocalDate checkDate = task.getNextExecution();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN))) {
|
if (date.equals(task.getNextExecution()) || (date.equals(checkDate) && !date.isAfter(task.getEndDate().orElse(LocalDate.MIN)))) {
|
||||||
dayTaskList.get(finalI).add(task);
|
dayTaskList.get(finalI).add(task);
|
||||||
}
|
}
|
||||||
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
|
checkDate = checkDate.plusDays(task.getInterval().orElse(0));
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class Task {
|
||||||
* @return Whether the Task is within the given range
|
* @return Whether the Task is within the given range
|
||||||
*/
|
*/
|
||||||
public boolean isInTimePeriod(LocalDate searchStartDate, LocalDate searchEndDate) {
|
public boolean isInTimePeriod(LocalDate searchStartDate, LocalDate searchEndDate) {
|
||||||
return endDate.isAfter(searchStartDate) && startDate.isBefore(searchEndDate) || (nextExecution != null && nextExecution.isBefore(searchEndDate) && nextExecution.isAfter(searchStartDate));
|
return (endDate.isAfter(searchStartDate) && startDate.isBefore(searchEndDate)) || ((nextExecution != null && nextExecution.isBefore(searchEndDate.plusDays(1)) && nextExecution.isAfter(searchStartDate.minusDays(1))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue