[Bug #1304] Make sumOfAssignedEffort return the cached value only for orders.

In other cases, the actual value will be calculated and returned, to use more
accurate data.

FEA: ItEr75S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2011-12-22 13:40:16 +01:00
parent c2889c88b7
commit e38fb82591
2 changed files with 10 additions and 11 deletions

View file

@ -688,10 +688,16 @@ public abstract class TaskElement extends BaseEntity {
}
public EffortDuration getSumOfAssignedEffort() {
return sumOfAssignedEffort;
if (this.getParent() == null) {
//it's an order, we use the cached value
return sumOfAssignedEffort;
}
else {
return getSumOfAssignedEffortCalculated();
}
}
public EffortDuration getSumOfAssignedEffortCalculated() {
private EffortDuration getSumOfAssignedEffortCalculated() {
EffortDuration result = EffortDuration.hours(0);
for(ResourceAllocation<?> allocation : getAllResourceAllocations()) {
result = result.plus(allocation.getAssignedEffort());

View file

@ -600,15 +600,8 @@ public class TaskElementAdapter {
}
if (taskElement.getOrderElement() != null) {
if(taskElement.getParent() == null){
//it's an order, we use the cached value
hours = taskElement.getSumOfAssignedEffort()
.toHoursAsDecimalWithScale(2);
}
else {
hours = taskElement.getSumOfAssignedEffortCalculated()
.toHoursAsDecimalWithScale(2);;
}
hours = taskElement.getSumOfAssignedEffort()
.toHoursAsDecimalWithScale(2);
}
// Calculate date according to advanceHours or advancePercentage