diff --git a/lib/taskjuggler/ResourceScenario.rb b/lib/taskjuggler/ResourceScenario.rb index b45e749e..0285bfc5 100644 --- a/lib/taskjuggler/ResourceScenario.rb +++ b/lib/taskjuggler/ResourceScenario.rb @@ -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) diff --git a/lib/taskjuggler/TimeSheets.rb b/lib/taskjuggler/TimeSheets.rb index 91ecd699..13b764cf 100644 --- a/lib/taskjuggler/TimeSheets.rb +++ b/lib/taskjuggler/TimeSheets.rb @@ -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.") @@ -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.