ItEr52S04ValidacionEProbasFuncionaisItEr51S04: [Bug #400] Fixed using the date from WorkReportLines instead of WorkReport to calculate the earned value chart.
This commit is contained in:
parent
bafae1638a
commit
347206d013
3 changed files with 15 additions and 30 deletions
|
|
@ -21,6 +21,7 @@
|
|||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
|
|
@ -119,8 +120,7 @@ public class HoursCostCalculator implements ICostCalculator {
|
|||
}
|
||||
|
||||
for (WorkReportLine workReportLine : workReportLines) {
|
||||
LocalDate day = new LocalDate(workReportLine.getWorkReport()
|
||||
.getDate());
|
||||
LocalDate day = new LocalDate(workReportLine.getDate());
|
||||
BigDecimal cost = new BigDecimal(workReportLine.getNumHours());
|
||||
|
||||
if (!result.containsKey(day)) {
|
||||
|
|
|
|||
|
|
@ -873,8 +873,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
}
|
||||
|
||||
for (WorkReportLine workReportLine : workReportLines) {
|
||||
LocalDate day = new LocalDate(workReportLine.getWorkReport()
|
||||
.getDate());
|
||||
LocalDate day = new LocalDate(workReportLine.getDate());
|
||||
BigDecimal cost = new BigDecimal(workReportLine.getNumHours());
|
||||
|
||||
if (!result.containsKey(day)) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ import org.navalplanner.business.users.entities.OrderAuthorizationType;
|
|||
import org.navalplanner.business.users.entities.User;
|
||||
import org.navalplanner.business.users.entities.UserRole;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportLineDAO;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
import org.navalplanner.web.calendars.BaseCalendarModel;
|
||||
import org.navalplanner.web.common.ViewSwitcher;
|
||||
import org.navalplanner.web.planner.ITaskElementAdapter;
|
||||
|
|
@ -1178,7 +1177,18 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
}
|
||||
|
||||
protected void calculateActualCostWorkPerformed(Interval interval) {
|
||||
SortedMap<LocalDate, BigDecimal> workReportCost = getWorkReportCost();
|
||||
List<TaskElement> list = order
|
||||
.getAllChildrenAssociatedTaskElements();
|
||||
list.add(order.getAssociatedTaskElement());
|
||||
|
||||
SortedMap<LocalDate, BigDecimal> workReportCost = new TreeMap<LocalDate, BigDecimal>();
|
||||
|
||||
for (TaskElement taskElement : list) {
|
||||
if (taskElement instanceof Task) {
|
||||
addCost(workReportCost, hoursCostCalculator
|
||||
.getWorkReportCost((Task) taskElement));
|
||||
}
|
||||
}
|
||||
|
||||
workReportCost = accumulateResult(workReportCost);
|
||||
addZeroBeforeTheFirstValue(workReportCost);
|
||||
|
|
@ -1186,30 +1196,6 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
workReportCost, interval.getStart(), interval.getFinish()));
|
||||
}
|
||||
|
||||
public SortedMap<LocalDate, BigDecimal> getWorkReportCost() {
|
||||
SortedMap<LocalDate, BigDecimal> result = new TreeMap<LocalDate, BigDecimal>();
|
||||
|
||||
List<WorkReportLine> workReportLines = workReportLineDAO
|
||||
.findByOrderElementAndChildren(order);
|
||||
|
||||
if (workReportLines.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (WorkReportLine workReportLine : workReportLines) {
|
||||
LocalDate day = new LocalDate(workReportLine.getWorkReport()
|
||||
.getDate());
|
||||
BigDecimal cost = new BigDecimal(workReportLine.getNumHours());
|
||||
|
||||
if (!result.containsKey(day)) {
|
||||
result.put(day, BigDecimal.ZERO);
|
||||
}
|
||||
result.put(day, result.get(day).add(cost));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void calculateBudgetedCostWorkPerformed(Interval interval) {
|
||||
List<TaskElement> list = order
|
||||
.getAllChildrenAssociatedTaskElements();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue