[Bug #1304] Don't use the cached value sumOfHoursAllocated when drawing the

progress bars of tasks.

This unupdated cached value is causing the bug. We will use it only in company
view, where allocations can't change.

FEA: ItEr75S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2011-12-20 17:47:13 +01:00
parent 954a45b1d6
commit 815f817031
2 changed files with 15 additions and 1 deletions

View file

@ -695,6 +695,14 @@ public abstract class TaskElement extends BaseEntity {
return sumOfHoursAllocated;
}
public Integer getSumOfHoursAllocatedCalculated() {
int result = 0;
for(ResourceAllocation<?> allocation : getAllResourceAllocations()) {
result += allocation.getAssignedHours();
}
return result;
}
public String toString() {
return super.toString() + " :: " + getName();
}

View file

@ -597,7 +597,13 @@ public class TaskElementAdapter {
private GanttDate getAdvanceEndDate(BigDecimal advancePercentage) {
Integer hours = Integer.valueOf(0);
if (taskElement.getOrderElement() != null) {
hours = taskElement.getSumOfHoursAllocated();
if(taskElement.getParent() == null){
//it's an order, we use the cached value
hours = taskElement.getSumOfHoursAllocated();
}
else {
hours = taskElement.getSumOfHoursAllocatedCalculated();
}
}
if (taskElement instanceof TaskGroup) {