Patch for bug 372694
- From: Jordi Mas <jordimash gmail com>
- To: planner-dev-list gnome org
- Subject: Patch for bug 372694
- Date: Sun, 31 Dec 2006 15:47:38 +0100
Hi!
I have been working on bug 372694. Here is a patch that fixes it.
Basically, we were dividing by zero in two places. I'm not
so familiar with the project management logic, but I think that if the
units of the resource are zero is correct to ignore them.
If it is ok for everyone, I'll commit this soon.
Regards,
Index: mrp-task-manager.c
===================================================================
--- mrp-task-manager.c (revision 823)
+++ mrp-task-manager.c (working copy)
@@ -1782,10 +1782,15 @@
}
if (effort + delta >= work) {
- finish = t1 + floor (0.5 + (work - effort) / unit_ival->units * 100.0);
-
- /* Subtract the spill. */
- *duration -= floor (0.5 + (effort + delta - work) / unit_ival->units * 100.0);
+ /* Subtract the spill to duration. */
+ if (unit_ival->units) {
+ finish = t1 + floor (0.5 + (work - effort) / unit_ival->units * 100.0);
+ *duration -= floor (0.5 + (effort + delta - work) / unit_ival->units * 100.0);
+ } else {
+ finish = t1 + floor (work - effort);
+ *duration -= floor (0.5 + (effort + delta - work));
+ }
+
unit_ival->start = t1;
unit_ival->end = finish;
unit_ivals_tot = g_list_prepend (unit_ivals_tot, unit_ival);
@@ -1937,10 +1942,14 @@
*duration += (t2 - t1);
if (effort + delta >= work) {
- start = t2 - floor (0.5 + (work - effort) / unit_ival->units * 100.0);
-
- /* Subtract the spill. */
- *duration -= floor (0.5 + (effort + delta - work) / unit_ival->units * 100.0);
+ /* Subtract the spill to duration. */
+ if (unit_ival->units) {
+ start = t2 - floor (0.5 + (work - effort) / unit_ival->units * 100.0);
+ *duration -= floor (0.5 + (effort + delta - work) / unit_ival->units * 100.0);
+ } else {
+ start = t2 - floor (0.5 + (work - effort));
+ *duration -= floor (0.5 + (effort + delta - work));
+ }
goto done;
}
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]