Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix: Ensure that 'length' considers task 'shifts' as well.

Reported by: Wim Langers
#114
  • Loading branch information...
commit 24c4430691868726800dc2a3fa3734feaf0f2b49 1 parent ff0da00
@scrapper scrapper authored
View
12 lib/taskjuggler/TaskScenario.rb
@@ -1755,7 +1755,7 @@ def scheduleSlot
when :lengthTask
bookResources
# The doneLength is only increased for global working time slots.
- @doneLength += 1 if @project.isWorkingTime(@currentSlotIdx)
+ @doneLength += 1 if onShift?(@currentSlotIdx)
# If we have reached the specified duration or lengths, we set the end
# or start date and propagate the value to neighbouring tasks.
@@ -1947,6 +1947,14 @@ def bookResource(resource)
booked
end
+ def onShift?(sbIdx)
+ if @shifts && @shifts.assigned?(sbIdx)
+ return @shifts.onShift?(sbIdx)
+ else
+ return @project.isWorkingTime(sbIdx)
+ end
+ end
+
# Check if all of the task limits are not exceded at the given _sbIdx_. If
# a _resource_ is provided, the limit for that particular resource is
# checked. If no resource is provided, only non-resource-specific limits
@@ -2045,7 +2053,7 @@ def bookBookings
startIdx = @project.dateToIdx(date = @start)
endIdx = @project.dateToIdx(@project['now'])
startIdx.upto(endIdx) do |idx|
- @doneLength += 1 if @project.isWorkingTime(idx)
+ @doneLength += 1 if onShift?(idx)
date += slotDuration
# Continue not only until the @length has been reached, but also
# the tentativeEnd date. This allows us to detect overbookings.
View
20 lib/taskjuggler/TjpSyntaxRules.rb
@@ -6327,9 +6327,9 @@ def rule_taskScenarioAttributes
setDurationAttribute('length', @val[1])
})
doc('length', <<'EOT'
-Specifies the global working time to be used for this task. The value is
-specified in working time, not calendar time. 7d means 7 working days, or 7
-times 8 hours (assuming default settings), not one week.
+Specifies the duration of this task as working time, not calendar time. 7d
+means 7 working days, or 7 times 8 hours (assuming default settings), not one
+week.
A task with a length specification may have resource allocations. Resources
are allocated when they are available. There is no guarantee that the task
@@ -6338,12 +6338,14 @@ def rule_taskScenarioAttributes
is available is still considered working time, if there is no global vacation
and global working hours are defined accordingly.
-For the length calculation, only the global working hours and the global
-leaves matter. If a resource has additinal working hours defined, it's
-quite possible that a task with a length of 5d will have an allocated effort
-larger than 40 hours. Resource working hours only have an impact on whether an
-allocation is made or not for a particular time slot. They don't effect the
-resulting duration of the task.
+For the length calculation, the global working hours and the global leaves
+matter unless the task has [[shifts.task|shifts]] assigned. In the latter case
+the working hours and leaves of the shift apply for the specified period to
+determine if a slot is working time or not. If a resource has additinal
+working hours defined, it's quite possible that a task with a length of 5d
+will have an allocated effort larger than 40 hours. Resource working hours
+only have an impact on whether an allocation is made or not for a particular
+time slot. They don't effect the resulting duration of the task.
Tasks may not have subtasks if this attribute is used. Setting this attribute
will reset the [[duration]], [[effort]] and [[milestone]] attributes.
View
2  test/TestSuite/Export-Reports/refs/Shift.tjp
@@ -57,7 +57,7 @@ resource r2 "Resource2"
task t1 "Task1" {
start 2000-01-01-07:00-+0000
- end 2000-02-05-00:00-+0000
+ end 2000-02-08-20:00-+0000
scheduling asap
scheduled
}
Please sign in to comment.
Something went wrong with that request. Please try again.