Commit 02c86c6a authored by Frank Bergmann's avatar Frank Bergmann

- Finished forward scheduling using faked Resource Calendar

parent 860ccc21
...@@ -333,9 +333,7 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', { ...@@ -333,9 +333,7 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
// Calculate the percent assigned in total // Calculate the percent assigned in total
var assignedPercent = 0.0 var assignedPercent = 0.0
assignees.forEach(function(assig) { assignees.forEach(function(assig) { assignedPercent = assignedPercent + assig.percent });
assignedPercent = assignedPercent + assig.percent
});
// Check what time // Check what time
var startDate = new Date(timeMoment); var startDate = new Date(timeMoment);
...@@ -428,9 +426,8 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', { ...@@ -428,9 +426,8 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
if (newEndTime == previousEndTime) return false; // skip if no change if (newEndTime == previousEndTime) return false; // skip if no change
// Write the newEndDate into model // Write the newEndDate into model
newEndDate = new Date(newEndTime); var newEndDate = new Date(newEndTime);
var newEndDateString = PO.Utilities.dateToPg(newEndDate); var newEndDateString = PO.Utilities.dateToPg(newEndDate);
// newEndDateString = newEndDateString.substring(0,10) + ' 23 :59:59';
newEndDateString = newEndDateString.substring(0,19); newEndDateString = newEndDateString.substring(0,19);
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkTaskLength: end_date='+newEndDateString); if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkTaskLength: end_date='+newEndDateString);
model.set('end_date', newEndDateString); model.set('end_date', newEndDateString);
...@@ -902,37 +899,20 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', { ...@@ -902,37 +899,20 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
// Calculate the percent assigned in total // Calculate the percent assigned in total
var assignedPercent = 0.0 var assignedPercent = 0.0
assignees.forEach(function(assig) { assignees.forEach(function(assig) { assignedPercent = assignedPercent + assig.percent });
assignedPercent = assignedPercent + assig.percent
});
if (0 == assignedPercent) { return []; } // No assignments - "manually scheduled" task if (0 == assignedPercent) { return []; } // No assignments - "manually scheduled" task
var durationHours = plannedUnits * 100.0 / assignedPercent; // Calculate the duration of the task in hours // Calculate the new endDate
var newEndTime = me.taskForwardDuration(treeStore, model);
// Adjust the time period, so that the effective hours >= durationHours if (newEndTime == previousEndTime) return []; // skip if no change
var startTime = previousStartDate.getTime();
var endTime = startTime;
var hours = 0.0; //
while (hours < durationHours) {
var day = new Date(endTime);
var dayOfWeek = day.getDay();
if (dayOfWeek == 6 || dayOfWeek == 0) {
// Weekend - just skip the day
} else {
hours = hours + 8; // Weekday - add hours
}
endTime = endTime + 1000 * 3600 * 24;
}
endTime = endTime - 1000 * 3600 * 24; // ]po[ sematics: zero time => 1 day
if (endTime == previousEndTime) return []; // skip if no change // Write the newEndDate into model
var newEndDate = new Date(newEndTime);
var newEndDateString = PO.Utilities.dateToPg(newEndDate);
newEndDateString = newEndDateString.substring(0,19);
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.scheduleTaskDuration: end_date='+newEndDateString);
model.set('end_date', newEndDateString);
// Write the new endDate into model
endDate = new Date(endTime);
endDateString = PO.Utilities.dateToPg(endDate);
endDateString = endDateString.substring(0,10) + ' 23:59:59';
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.scheduleTaskDuration: end_date='+endDateString);
model.set('end_date', endDateString);
if (me.debug > 1) console.log('PO.controller.gantt_editor.GanttSchedulingController.scheduleTaskDuration: Finished'); if (me.debug > 1) console.log('PO.controller.gantt_editor.GanttSchedulingController.scheduleTaskDuration: Finished');
return [model]; return [model];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment