[Bug #1096] Fix bug
Consider also the deadline when calculating the initial zoom level. FEA: ItEr75S04BugFixing
This commit is contained in:
parent
4ae60ee70d
commit
bae087dff9
2 changed files with 21 additions and 8 deletions
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.navalplanner.business.workingday.EffortDuration.zero;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -93,15 +94,28 @@ public abstract class TaskElement extends BaseEntity {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static Comparator<? super TaskElement> getByEndDateComparator() {
|
||||
Comparator<TaskElement> result = new Comparator<TaskElement>() {
|
||||
public static Comparator<? super TaskElement> getByEndAndDeadlineDateComparator() {
|
||||
return new Comparator<TaskElement>() {
|
||||
|
||||
@Override
|
||||
public int compare(TaskElement o1, TaskElement o2) {
|
||||
return o1.getEndDate().compareTo(o2.getEndDate());
|
||||
return o1.getBiggestAmongEndOrDeadline().compareTo(
|
||||
o2.getBiggestAmongEndOrDeadline());
|
||||
}
|
||||
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the biggest one among the deadline (if exists) or the end date.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public LocalDate getBiggestAmongEndOrDeadline() {
|
||||
if (this.getDeadline() != null) {
|
||||
return Collections.max(asList(this.getDeadline(),
|
||||
this.getEndAsLocalDate()));
|
||||
}
|
||||
return this.getEndAsLocalDate();
|
||||
}
|
||||
|
||||
protected static <T extends TaskElement> T create(T taskElement,
|
||||
|
|
|
|||
|
|
@ -216,11 +216,10 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
TaskElement
|
||||
.getByStartDateComparator());
|
||||
TaskElement latest = Collections.max(configuration.getData(),
|
||||
TaskElement.getByEndDateComparator());
|
||||
TaskElement.getByEndAndDeadlineDateComparator());
|
||||
|
||||
LocalDate startDate = LocalDate.fromDateFields(earliest
|
||||
.getStartDate());
|
||||
LocalDate endDate = LocalDate.fromDateFields(latest.getEndDate());
|
||||
LocalDate startDate = earliest.getStartAsLocalDate();
|
||||
LocalDate endDate = latest.getBiggestAmongEndOrDeadline();
|
||||
return ZoomLevel.getDefaultZoomByDates(startDate, endDate);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue