Skip to content

Commit

Permalink
Fix: gaplength/gapduration now works with onstart/onend of effort tasks
Browse files Browse the repository at this point in the history
Reported-by: Bob Newell
  • Loading branch information
scrapper committed Aug 17, 2013
1 parent f2ff40e commit 43cc25d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
12 changes: 3 additions & 9 deletions lib/taskjuggler/TaskScenario.rb
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def propagateDate(date, atEnd, ignoreEffort = false)
"to task #{@property.id}")
thisEnd = atEnd ? 'end' : 'start'
otherEnd = atEnd ? 'start' : 'end'
#puts "Propagating #{thisEnd} date #{date} of #{@property.fullId} " +
#puts "Propagating #{thisEnd} date #{date} to #{@property.fullId} " +
# "#{ignoreEffort ? "ignoring effort" : "" }"

# These flags are just used to avoid duplicate calls of this function
Expand Down Expand Up @@ -1898,19 +1898,13 @@ def bookResource(resource)
# slot.
if @effort > 0 && @assignedresources.empty?
if @forward
@start = @project.idxToDate(@currentSlotIdx)
propagateDate(@project.idxToDate(@currentSlotIdx), false, true)
Log.msg { "Task #{@property.fullId} first assignment: " +
"#{period_to_s}" }
@startsuccs.each do |task, onEnd|
task.propagateDate(@scenarioIdx, @start, false, true)
end
else
@end = @project.idxToDate(@currentSlotIdx + 1)
propagateDate(@project.idxToDate(@currentSlotIdx + 1), true, true)
Log.msg { "Task #{@property.fullId} last assignment: " +
"#{period_to_s}" }
@endpreds.each do |task, onEnd|
task.propagateDate(@scenarioIdx, @end, true, true)
end
end
end

Expand Down
17 changes: 9 additions & 8 deletions lib/taskjuggler/TjpSyntaxRules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5926,21 +5926,22 @@ def rule_taskDepAttributes
@taskDependency.gapDuration = @val[1]
})
doc('gapduration', <<'EOT'
Specifies the minimum required gap between the end of a preceding task and the
start of this task, or the start of a following task and the end of this task.
This is calendar time, not working time. 7d means one week.
Specifies the minimum required gap between the start or end of a preceding
task and the start of this task, or the start or end of a following task and
the end of this task. This is calendar time, not working time. 7d means one
week.
EOT
)

pattern(%w( _gaplength !workingDuration ), lambda {
@taskDependency.gapLength = @val[1]
})
doc('gaplength', <<'EOT'
Specifies the minimum required gap between the end of a preceding task and the
start of this task, or the start of a following task and the end of this task.
This is working time, not calendar time. 7d means 7 working days, not one
week. Whether a day is considered a working day or not depends on the defined
working hours and global leaves.
Specifies the minimum required gap between the start or end of a preceding
task and the start of this task, or the start or end of a following task and
the end of this task. This is working time, not calendar time. 7d means 7
working days, not one week. Whether a day is considered a working day or not
depends on the defined working hours and global leaves.
EOT
)

Expand Down
17 changes: 17 additions & 0 deletions test/TestSuite/Scheduler/Correct/Depends.tjp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ project test "Test" "1.0" 2007-04-02 +3m

include "checks.tji"

resource r1 "R1"
resource r2 "R2"

task t1 "T1" {
start ${projectstart}
duration 1w
Expand Down Expand Up @@ -38,6 +41,20 @@ task t6 "T6" {
${FixTask "2007-05-11-17:00" "2007-05-18-17:00"}
}

task t7 "T7" {
start ${projectstart}
effort 1w
allocate r1
${FixEnd "2007-04-06-17:00"}
}

task t8 "T8" {
depends t7 { onstart gaplength 1w }
effort 1w
allocate r2
${FixTask "2007-04-9-9:00" "2007-04-13-17:00"}
}

taskreport depends "Depends" {
formats html
columns name, start, end, daily
Expand Down
17 changes: 17 additions & 0 deletions test/TestSuite/Scheduler/Correct/Precedes.tjp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ project test "Test" "1.0" 2007-04-02 - 2007-07-01

include "checks.tji"

resource r1 "R1"
resource r2 "R2"

task t1 "T1" {
end ${projectend}
duration 1w
Expand Down Expand Up @@ -38,6 +41,20 @@ task t6 "T6" {
${FixTask "2007-05-14-9:00" "2007-05-21-9:00"}
}

task t7 "T7" {
end ${projectend}
effort 1w
allocate r1
${FixStart "2007-06-25-9:00"}
}

task t8 "T8" {
precedes t7 { onend gaplength 1w }
effort 1w
allocate r2
${FixTask "2007-06-18-9:00" "2007-06-22-17:00"}
}

taskreport preceds "Precedes" {
formats html
columns name, start, end, daily
Expand Down

0 comments on commit 43cc25d

Please sign in to comment.