Index: openacs-4/contrib/packages/project-manager/project-manager.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/Attic/project-manager.info,v diff -u -r1.25 -r1.26 --- openacs-4/contrib/packages/project-manager/project-manager.info 7 Jun 2004 16:36:54 -0000 1.25 +++ openacs-4/contrib/packages/project-manager/project-manager.info 21 Jun 2004 22:20:43 -0000 1.26 @@ -7,14 +7,14 @@ f f - + Jade Rubick Project management tool for OpenACS - 2004-06-07 + 2004-06-21 Integrated Bakery Resources Track tasks, estimates and actual progress for a project. See the <a href="http://openacs.org/projects/dotwrk/project_management/">project page</a> for more information. - + @@ -24,8 +24,8 @@ - + + (i-1 means an item that this task depends on) + +

+ + These algorithms are explained at: + http://mscmga.ms.ic.ac.uk/jeb/or/netaon.html

+ Tasks in ongoing projects are given null completion dates, unless they already have deadlines. @@ -636,6 +647,8 @@ # Before hacking on this, you might want to look at: # http://www.joelonsoftware.com/articles/fog0000000069.html + set debug 0 + # TODO: # # ------------------------------------------------------------------------- @@ -659,7 +672,9 @@ # should look at: # http://mscmga.ms.ic.ac.uk/jeb/or/netaon.html - # ns_log Notice "-----------------------------------------" + if {[string is true $debug]} { + ns_log Notice "-----------------------------------------" + } # -------------------------------------------------------------------- # for now, hardcode in a day is 8 hours. Later, we want to set this by @@ -693,7 +708,9 @@ set task_list [concat $task_list $task_list_project] - # ns_log Notice "task_list: $task_list" + if {[string is true $debug]} { + ns_log Notice "Tasks in this project (task_list): $task_list" + } # ------------------------- # no tasks for this project @@ -710,13 +727,19 @@ # today_j (julian date for today) db_1row tasks_group_query { } - # ns_log notice "Julian today: $today_j" + if {[string is true $debug]} { + ns_log notice "Today's date (julian format): $today_j" + } # -------------------------------------------------------------- # Set up activity_time for all tasks # Also set up deadlines for tasks that have hard-coded deadlines # -------------------------------------------------------------- + if {[string is true $debug]} { + ns_log notice "Going through tasks and saving their values" + } + db_foreach tasks_query { } { # We now save information about all the tasks, so that we can @@ -732,13 +755,17 @@ set old_LF_j($my_iid) $old_latest_finish_j set old_task_status($my_iid) $status_type - # ns_log Notice "old_task_status: $my_iid $status_type" + if {[string is true $debug]} { + ns_log Notice "old_task_status: $my_iid $status_type (o=open, c=closed)" + } set activity_time($my_iid) [expr $to_work - $worked] if {[exists_and_not_null task_deadline_j]} { - # ns_log notice "$my_iid has a deadline $task_deadline_j" + if {[string is true $debug]} { + ns_log notice "$my_iid has a deadline (julian: $task_deadline_j)" + } set latest_finish($my_iid) $task_deadline_j @@ -765,7 +792,9 @@ set dependency_types($task_item_id-$parent_task_id) $dependency_type - # ns_log Notice "dependency (id: $dependency_id) task: $task_item_id parent: $parent_task_id type: $dependency_type" + if {[string is true $debug]} { + ns_log Notice "dependency (id: $dependency_id) task: $task_item_id parent: $parent_task_id type: $dependency_type" + } } @@ -778,7 +807,7 @@ # if ongoing_p is t, then end_date_j should be null db_1row project_info { } - if {[string equal $ongoing_p t] && ![empty_string_p $end_date_j]} { + if {[string is true $ongoing_p] && ![empty_string_p $end_date_j]} { ns_log Error "Project cannot be ongoing and have a non-null end-date. Setting end date to blank" set end_date_j "" } @@ -817,24 +846,31 @@ if {![info exists depends($task_item)]} { set earliest_start($task_item) $start_date_j - #set earliest_finish($task_item) [expr $earliest_start($task_item) + [expr $activity_time($task_item) / double($hours_day)]] set earliest_finish($task_item) [earliest_finish $earliest_start($task_item) $activity_time($task_item) $hours_day] lappend present_tasks $task_item - # ns_log Notice "Begin earliest_start($task_item): $earliest_start($task_item)" + if {[string is true $debug]} { + ns_log Notice "preliminary earliest_start($task_item): $earliest_start($task_item)" + } } } # ------------------------------- # stop if we have no dependencies # ------------------------------- if {[llength $present_tasks] == 0} { - # ns_log Notice "No tasks with dependencies" + + if {[string is true $debug]} { + ns_log Notice "No tasks with dependencies" + } + return [list] } - # ns_log Notice "present_tasks: $present_tasks" + if {[string is true $debug]} { + ns_log Notice "present_tasks: $present_tasks" + } # ------------------------------------------------------ # figure out the earliest start and finish times @@ -846,7 +882,9 @@ foreach task_item $present_tasks { - # ns_log Notice "this task_item: $task_item" + if {[string is true $debug]} { + ns_log Notice "-this task_item: $task_item" + } # ----------------------------------------------------- # some tasks may already have earliest_start filled in @@ -856,7 +894,9 @@ if {![exists_and_not_null earliest_start($task_item)]} { - # ns_log Notice " !info exists for $task_item" + if {[string is true $debug]} { + ns_log Notice " !info exists for $task_item" + } # --------------------------------------------- # set the earliest_start for this task = @@ -885,10 +925,12 @@ set earliest_finish($task_item) [earliest_finish $max_earliest_start $activity_time($task_item) $hours_day] - # ns_log Notice \ - # " earliest_start ($task_item): $earliest_start($task_item)" - # ns_log Notice \ - # " earliest_finish($task_item): $earliest_finish($task_item)" + if {[string is true $debug]} { + ns_log Notice \ + " earliest_start ($task_item): $earliest_start($task_item)" + ns_log Notice \ + " earliest_finish($task_item): $earliest_finish($task_item)" + } } @@ -901,7 +943,9 @@ } } - # ns_log Notice "future tasks: $future_tasks" + if {[string is true $debug]} { + ns_log Notice "future tasks: $future_tasks" + } set present_tasks $future_tasks } @@ -914,10 +958,14 @@ foreach task_item $task_list { - # ns_log Notice "*Earliest start ($task_item): $earliest_start($task_item)" + if {[string is true $debug]} { + ns_log Notice "* Earliest start ($task_item): $earliest_start($task_item)" + } + if {$max_earliest_finish < $earliest_finish($task_item)} { set max_earliest_finish $earliest_finish($task_item) } + } @@ -998,13 +1046,17 @@ # info for these items # ----------------------------------------------------- - # ns_log Notice "Starting foreach task-item $task_list" + if {[string is true $debug]} { + ns_log Notice "Starting foreach task-item $task_list" + } foreach task_item $task_list { if {![info exists dependent($task_item)]} { - # ns_log Notice " !info exists dependent($task_item)" + if {[string is true $debug]} { + ns_log Notice " !info exists dependent($task_item)" + } # we check this because some tasks already have # hard deadlines set. @@ -1015,12 +1067,17 @@ # has precedence. However, sometimes the project is # ongoing, so we have to make sure that there actually # is an end_date_j - if {![empty_string_p $end_date_j]} { - if {$end_date_j < $latest_finish($task_item)} { - set latest_finish($task_item) $end_date_j - } - } + # commented out: we need to trust the user. If they + # set the deadline outside the project deadline, + # that's their business + + #if {![empty_string_p $end_date_j]} { + # if {$end_date_j < $latest_finish($task_item)} { + # set latest_finish($task_item) $end_date_j + # } + #} + # we also set the latest_start date set late_start_temp \ @@ -1042,7 +1099,10 @@ # we specify that the task is an ongoing task if {[empty_string_p $end_date_j]} { set ongoing_task($task_item) true - # ns_log Notice "NSDBAHNITD: end_date_j was empty ti:$task_item" + + if {[string is true $debug]} { + ns_log Notice "NSDBAHNITD: end_date_j was empty ti:$task_item" + } } else { set latest_finish($task_item) $end_date_j @@ -1056,9 +1116,20 @@ } lappend present_tasks $task_item - # ns_log Notice "Begin latest_start($task_item): $latest_start($task_item) latest_finish: $latest_finish($task_item)" + if {[string is true $debug] && [exists_and_not_null latest_start($task_item)]} { + ns_log Notice "preliminary latest_start($task_item): $latest_start($task_item)" + } + + if {[string is true $debug] && [exists_and_not_null latest_finish($task_item)]} { + ns_log Notice "preliminary latest_finish($task_item): $latest_finish($task_item)" + } + + + } else { - #ns_log Notice " info exists dependent($task_item)" + if {[string is true $debug]} { + ns_log Notice " info exists dependent($task_item)" + } } } @@ -1067,11 +1138,15 @@ # stop if we have no dependencies # ------------------------------- if {[llength $present_tasks] == 0} { - # ns_log Notice "No tasks with dependencies" + if {[string is true $debug]} { + ns_log Notice "No tasks with dependencies" + } return [list] } - # ns_log Notice "LATEST present_tasks: $present_tasks" + if {[string is true $debug]} { + ns_log Notice "LATEST present_tasks: $present_tasks" + } # ------------------------------------------------------ # figure out the latest start and finish times @@ -1083,7 +1158,9 @@ foreach task_item $present_tasks { - # ns_log Notice "this task_item: $task_item" + if {[string is true $debug]} { + ns_log Notice "this task_item: $task_item" + } # ----------------------------------------------------- # some tasks may already have latest_start filled in. @@ -1093,7 +1170,9 @@ if {[info exists dependent($task_item)]} { - # ns_log Notice " info exists for dependent($task_item)" + if {[string is true $debug]} { + ns_log Notice " info exists for dependent($task_item)" + } # --------------------------------------------- # set the latest_start for this task = @@ -1103,20 +1182,31 @@ # (i means this task) # --------------------------------------------- - # we set this to the end date, and then move it back + # we set this to the end date, and then move it forward # as we find dependent items that have earlier # latest_start dates. The problem is that the # end_date_j is empty when there is no deadline. # So we need to remember that min_latest_start can # be an empty value set min_latest_start $end_date_j + if {[string is true $debug]} { + ns_log Notice " min_latest_start: $end_date_j" + } + foreach dependent_item $dependent($task_item) { - + + if {[string is true $debug]} { + ns_log Notice " dependent_item: $dependent_item" + } + if {[exists_and_not_null ongoing_task($dependent_item)]} { set defer_p f set my_latest_start "" - # ns_log Notice "ongoing_task, no defer" + + if {[string is true $debug]} { + ns_log Notice " ongoing_task, no defer" + } } elseif {![exists_and_not_null latest_start($dependent_item)]} { # we defer the task if the dependent item has no @@ -1138,10 +1228,17 @@ # a deadline. :( if {$defer_count($task_item) > 5} { set defer_p f - # ns_log Notice " no defer because defer count exceeded" + + if {[string is true $debug]} { + ns_log Notice " no defer because defer count exceeded" + } } else { lappend future_tasks $task_item - # ns_log Notice " defer" + + if {[string is true $debug]} { + ns_log Notice " defer" + } + set defer_p t } @@ -1157,9 +1254,15 @@ -hours_to_complete $activity_time($task_item) \ -hours_day $hours_day] - # ns_log Notice " my_latest_start: $my_latest_start" - - if {$my_latest_start < $min_latest_start} { + if {[string is true $debug]} { + ns_log Notice " my_latest_start: $my_latest_start" + } + + if {[exists_and_not_null min_latest_start]} { + if {$my_latest_start < $min_latest_start} { + set min_latest_start $my_latest_start + } + } else { set min_latest_start $my_latest_start } @@ -1172,9 +1275,31 @@ # we check that latest_start doesn't already exist # which it might for hard-deadlines + + # we have to be fairly careful here. We want to + # set the latest_start date to the minimum + # latest_start, but only when min_latest_start + # actually has a value + if {[exists_and_not_null latest_start($task_item)]} { - if {$min_latest_start < $latest_start($task_item)} { - set latest_start($task_item) $min_latest_start + + if {[exists_and_not_null min_latest_start]} { + + if {$min_latest_start < $latest_start($task_item)} { + set latest_start($task_item) $min_latest_start + } + + } else { + + if {[string is true $debug]} { + ns_log notice " setting latest start date (ignoring min_latest_start" + } + set latest_start($task_item) \ + [latest_start \ + -end_date_j $latest_finish($task_item) \ + -hours_to_complete $activity_time($task_item) \ + -hours_day $hours_day] + } } else { @@ -1188,10 +1313,12 @@ set latest_start($task_item) $min_latest_start } - # ns_log Notice " min_latest_start: $min_latest_start" + if {[string is true $debug]} { + ns_log Notice " min_latest_start: $min_latest_start" + } # we now set the latest finish. Ongoing tasks set - # the latest finish to empty + # the latest finish to empty (sometimes) if {[empty_string_p $latest_start($task_item)]} { set temp_lf "" } else { @@ -1202,8 +1329,20 @@ # task, then we check whether temp_lf is earlier, # and set it to temp_lf if so + if {[string is true $debug]} { + ns_log Notice " temp_lf: $temp_lf" + } + if {[empty_string_p $temp_lf]} { - set latest_finish($task_item) "" + + # if the task is ongoing, we clear the + # latest_finish. Otherwise, we leave the + # latest_finish as it is. + + if {[exists_and_not_null ongoing_task($task_item)] && [string is true $ongoing_task($task_item)]} { + set latest_finish($task_item) "" + } + } else { if {[exists_and_not_null latest_finish($task_item)]} { if {$temp_lf < $latest_finish($task_item)} { @@ -1214,12 +1353,21 @@ } } - #ns_log Notice \ - # " latest_start ($task_item): $latest_start($task_item)" - #ns_log Notice \ - # " latest_finish($task_item): $latest_finish($task_item)" + if {[string is true $debug]} { + if {[exists_and_not_null latest_start($task_item)]} { + ns_log Notice \ + " latest_start ($task_item): $latest_start($task_item)" + } + if {[exists_and_not_null latest_finish($task_item)]} { + ns_log Notice \ + " latest_finish($task_item): $latest_finish($task_item)" + } + } + } else { - # ns_log Notice "Deferring $task_item" + if {[string is true $debug]} { + ns_log Notice "Deferring $task_item" + } } } @@ -1232,7 +1380,9 @@ } } - # ns_log Notice "future tasks: $future_tasks" + if {[string is true $debug]} { + ns_log Notice "future tasks: $future_tasks" + } set present_tasks $future_tasks } @@ -1249,7 +1399,10 @@ foreach task_item $task_list { - # ns_log Notice "*Latest start ($task_item): $latest_start($task_item)" + if {[string is true $debug]} { + ns_log Notice "*Latest start ($task_item): $latest_start($task_item)" + } + if {$min_latest_start > $latest_start($task_item)} { set max_earliest_finish $earliest_finish($task_item) } @@ -1304,7 +1457,9 @@ } - # ns_log Notice "*******************" + if {[string is true $debug]} { + ns_log Notice "*******************" + } return $task_list