Index: openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 4 Sep 2003 22:45:22 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 4 Sep 2003 23:18:23 -0000 1.3 @@ -25,10 +25,10 @@ actual_hours_completed numeric, estimated_hours_total numeric TASKS: - earliest start(i) = max(activity_time(i-1) + earliest_start(i-1)) + earliest start(i) = max(activity_time(i-1) + earliest_start(i-1)) earliest_finish(i) = earliest_start(i) + activity_time(i) - latest_start(i) = min(last_start(i+1) - activity_time(i) - latest_finish(i) = latest_start(i) + activity_time(i) + latest_start(i) = min(last_start(i+1) - activity_time(i) + latest_finish(i) = latest_start(i) + activity_time(i) The statistics are computed based on: @@ -67,7 +67,7 @@ # -------------------------------------------------------------------- # for now, hardcode in a day is 8 hours. Later, we want to set this by - # person + # person. Note also that it assumes everyone works 7 days a week # -------------------------------------------------------------------- set hours_day 8 @@ -331,9 +331,26 @@ if {![info exists dependent($task_item)]} { - set latest_finish($task_item) $end_date_j - set latest_start($task_item) [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]] + # we check this because some tasks already have + # hard deadlines set. + if {[info exists latest_finish($task_item)]} { + if {$end_date_j < $latest_finish($task_item)} { + set latest_finish($task_item) $end_date_j + } + + set late_start_temp [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]] + + if {$late_start_temp < $latest_start($task_item)} { + set latest_start($task_item) $late_start_temp + } + + } else { + + set latest_finish($task_item) $end_date_j + set latest_start($task_item) [expr $latest_finish($task_item) - [expr $activity_time($task_item) / double($hours_day)]] + } + lappend present_tasks $task_item ns_log Notice "Begin latest_start($task_item): $latest_start($task_item) latest_finish: $latest_finish($task_item)" @@ -403,9 +420,26 @@ if {[string equal $defer_p f]} { - set latest_start($task_item) $min_latest_start - set latest_finish($task_item) [expr $min_latest_start + [expr $activity_time($task_item) / double($hours_day)]] + # we check that latest_start doesn't already exist + # which it might for hard-deadlines + 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 + } + } else { + set latest_start($task_item) $min_latest_start + } + set temp [expr $min_latest_start + [expr $activity_time($task_item) / double($hours_day)]] + + if {[exists_and_not_null latest_finish($task_item)]} { + if {$temp < $latest_finish($task_item)} { + set latest_finish($task_item) + } + } else { + set latest_finish($task_item) $temp + } + ns_log Notice \ " latest_start ($task_item): $latest_start($task_item)" ns_log Notice \