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 25
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 51
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 35
def copy
  ShiftAssignment.new(@shiftScenario, TimeInterval.new(@interval))
end
hashKey() click to toggle source
# File lib/taskjuggler/ShiftAssignments.rb, line 30
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 61
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 56
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 40
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 46
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 66
def to_s
  "#{@shiftScenario.property.id} #{interval}"
end