Bug #1546: Force recalculation of critical path progresses on saving project
They were only calculated when you visited the dashboard perspective. Now they are calculated always when you save the project. FEA: ItEr77S04BugFixing
This commit is contained in:
parent
7ab8e7f07c
commit
2bdcb409d9
3 changed files with 12 additions and 2 deletions
|
|
@ -70,6 +70,7 @@ import org.libreplan.business.planner.entities.consolidations.CalculatedConsolid
|
||||||
import org.libreplan.business.requirements.entities.CriterionRequirement;
|
import org.libreplan.business.requirements.entities.CriterionRequirement;
|
||||||
import org.libreplan.business.resources.daos.ICriterionDAO;
|
import org.libreplan.business.resources.daos.ICriterionDAO;
|
||||||
import org.libreplan.business.resources.daos.IResourceDAO;
|
import org.libreplan.business.resources.daos.IResourceDAO;
|
||||||
|
import org.libreplan.business.resources.daos.IResourcesSearcher;
|
||||||
import org.libreplan.business.resources.entities.Criterion;
|
import org.libreplan.business.resources.entities.Criterion;
|
||||||
import org.libreplan.business.resources.entities.CriterionSatisfaction;
|
import org.libreplan.business.resources.entities.CriterionSatisfaction;
|
||||||
import org.libreplan.business.resources.entities.IAssignmentsOnResourceCalculator;
|
import org.libreplan.business.resources.entities.IAssignmentsOnResourceCalculator;
|
||||||
|
|
@ -87,6 +88,7 @@ import org.libreplan.business.users.entities.UserOrderAuthorization;
|
||||||
import org.libreplan.web.UserUtil;
|
import org.libreplan.web.UserUtil;
|
||||||
import org.libreplan.web.calendars.BaseCalendarModel;
|
import org.libreplan.web.calendars.BaseCalendarModel;
|
||||||
import org.libreplan.web.planner.TaskElementAdapter;
|
import org.libreplan.web.planner.TaskElementAdapter;
|
||||||
|
import org.libreplan.web.planner.tabs.CriticalPathBuilder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
|
@ -179,6 +181,9 @@ public class PlanningStateCreator {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMoneyCostCalculator moneyCostCalculator;
|
private IMoneyCostCalculator moneyCostCalculator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IResourcesSearcher resourcesSearcher;
|
||||||
|
|
||||||
void synchronizeWithSchedule(Order order, IOptionalPersistence persistence) {
|
void synchronizeWithSchedule(Order order, IOptionalPersistence persistence) {
|
||||||
List<TaskSourceSynchronization> synchronizationsNeeded = order
|
List<TaskSourceSynchronization> synchronizationsNeeded = order
|
||||||
.calculateSynchronizationsNeeded();
|
.calculateSynchronizationsNeeded();
|
||||||
|
|
@ -1115,6 +1120,10 @@ public class PlanningStateCreator {
|
||||||
savedOrderState = order.getState();
|
savedOrderState = order.getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TaskElement> getCriticalPath() {
|
||||||
|
return CriticalPathBuilder.criticalPathFor(this, resourcesSearcher);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IAllocationCriteria {
|
public interface IAllocationCriteria {
|
||||||
|
|
|
||||||
|
|
@ -384,6 +384,7 @@ public class SaveCommandBuilder {
|
||||||
// the deletes on cascade a new root task is fetched causing a
|
// the deletes on cascade a new root task is fetched causing a
|
||||||
// NonUniqueObjectException later
|
// NonUniqueObjectException later
|
||||||
taskElementDAO.reattach(rootTask);
|
taskElementDAO.reattach(rootTask);
|
||||||
|
rootTask.updateCriticalPathProgress(state.getCriticalPath());
|
||||||
}
|
}
|
||||||
orderDAO.save(order);
|
orderDAO.save(order);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public class CriticalPathBuilder {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TaskElement> criticalPathFor(PlanningState state,
|
public static List<TaskElement> criticalPathFor(PlanningState state,
|
||||||
IResourcesSearcher resourcesSearcher) {
|
IResourcesSearcher resourcesSearcher) {
|
||||||
final Order order = state.getOrder();
|
final Order order = state.getOrder();
|
||||||
final Scenario currentScenario = state.getCurrentScenario();
|
final Scenario currentScenario = state.getCurrentScenario();
|
||||||
|
|
@ -110,7 +110,7 @@ public class CriticalPathBuilder {
|
||||||
return criticalPathCalculator.calculateCriticalPath(graph);
|
return criticalPathCalculator.calculateCriticalPath(graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalDate asLocalDate(Date date) {
|
private static LocalDate asLocalDate(Date date) {
|
||||||
return date != null ? LocalDate.fromDateFields(date) : null;
|
return date != null ? LocalDate.fromDateFields(date) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue