class TaskJuggler::ShiftAssignment

A ShiftAssignment associate a specific defined shift with a time interval where the shift should be active.

Attributes

interval[RW]
shiftScenario[R]

Public Class Methods

new(shiftScenario, interval) click to toggle source
# File lib/taskjuggler/ShiftAssignments.rb, line 26
def initialize(shiftScenario, interval)
  @shiftScenario = shiftScenario
  @interval = interval
end

Public Instance Methods

assigned?(date) click to toggle source

Check if date is withing the assignment period.

# File lib/taskjuggler/ShiftAssignments.rb, line 52
def assigned?(date)
  @interval.start <= date && date < @interval.end
end
copy() click to toggle source

Return a deep copy of self.

# File lib/taskjuggler/ShiftAssignments.rb, line 36
def copy
  ShiftAssignment.new(@shiftScenario, TimeInterval.new(@interval))
end
hashKey() click to toggle source
# File lib/taskjuggler/ShiftAssignments.rb, line 31
def hashKey
  return "#{@shiftScenario.object_id}|#{@interval.start}|#{@interval.end}"
end
onLeave?(date) click to toggle source

Returns true if the shift has a leave defined for the date.

# File lib/taskjuggler/ShiftAssignments.rb, line 62
def onLeave?(date)
  @shiftScenario.onLeave?(date)
end
onShift?(date) click to toggle source

Returns true if the shift has working hours defined for the date.

# File lib/taskjuggler/ShiftAssignments.rb, line 57
def onShift?(date)
  @shiftScenario.onShift?(date)
end
overlaps?(iv) click to toggle source

Return true if the iv interval overlaps with the assignment interval.

# File lib/taskjuggler/ShiftAssignments.rb, line 41
def overlaps?(iv)
  @interval.overlaps?(iv)
end
replace?(date) click to toggle source

Returns true if the shift is active and requests to replace global leave settings.

# File lib/taskjuggler/ShiftAssignments.rb, line 47
def replace?(date)
  @interval.start <= date && date < @interval.end && @shiftScenario.replace?
end
to_s() click to toggle source

Primarily used for debugging

# File lib/taskjuggler/ShiftAssignments.rb, line 67
def to_s
  "#{@shiftScenario.property.id} #{interval}"
end