Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/taskjuggler/ResourceScenario.rb
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,14 @@ def countSlots(startIdx, endIdx)
slots
end

def countOnShiftSlots(startIdx, endIdx)
slots = 0
startIdx.upto(endIdx - 1) do |idx|
slots += 1 if onShift?(idx)
end
slots
end

# Limit the _startIdx_ and _endIdx_ to the actually assigned interval.
# If _task_ is provided, fit it for the bookings of this particular task.
def fitIndicies(startIdx, endIdx, task = nil)
Expand Down
9 changes: 5 additions & 4 deletions lib/taskjuggler/TimeSheets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ def check
# reported work.
delta = 1
if totalSlots < (targetSlots - delta)
error('ts_work_too_low',
warning('ts_work_too_low',
"The total work to be reported for this time sheet " +
"is #{workWithUnit(targetSlots)} but only " +
"#{workWithUnit(totalSlots)} were reported.")
end
if totalSlots > (targetSlots + delta)
error('ts_work_too_high',
warning('ts_work_too_high',
"The total work to be reported for this time sheet " +
"is #{workWithUnit(targetSlots)} but " +
"#{workWithUnit(totalSlots)} were reported.")
Expand Down Expand Up @@ -337,8 +337,9 @@ def totalNetWorkingSlots
project = @resource.project
startIdx = project.dateToIdx(@interval.start)
endIdx = project.dateToIdx(@interval.end)
@resource.getAllocatedSlots(@scenarioIdx, startIdx, endIdx, nil) +
@resource.getFreeSlots(@scenarioIdx, startIdx, endIdx)
shiftSlots = @resource.countOnShiftSlots(@scenarioIdx, startIdx, endIdx)
allocatedSlots = @resource.getAllocatedSlots(@scenarioIdx, startIdx, endIdx, nil)
[shiftSlots,allocatedSlots].max
end

# Converts allocation percentage into time slots.
Expand Down