app/models/events/event_staff_position_shift.rb
# Returns an array of the other shifts for this event that this shift overlaps with timewise. Shifts are only evaluated if they
# have a start time and an end time. Note that shifts that start and end at the same time (e.g., 1:30 pm) are *not* considered
# to be overlapping by this function (this is done by substracting 1 second from all of the end times when comparing).
Returns an array of the other shifts for this event that this shift overlaps with timewise. Shifts are only evaluated if they
have a start time and an end time. Note that shifts that start and end at the same time  are *not* considered
to be overlapping by this function (this is done by substracting 1 second from all of the end times when comparing).
Returns an array of the other shifts for this event that this shift overlaps with timewise . Shifts are only evaluated if they have a start time and an end time . Note that shifts that start and end at the same time are * not * considered to be overlapping by this function ( this is done by substracting 1 second from all of the end times when comparing ) .
def overlapping_shifts
    overlaps = []
    for other in event.staff_position_shifts.reject{|s| s == self}
      if start_time && end_time && other.start_time && other.end_time
        range = start_time..end_time-1.second
        if range.include?(other.start_time) || range.include?(other.end_time-1.second)
          overlaps << other
        end
      end
    end
    overlaps
  end
def overlapping_shifts overlaps = [ ] for other in event . staff_position_shifts . reject { | s | s == self } if start_time && end_time && other . start_time && other . end_time range = start_time .. end_time - 1 . second if range . include? ( other . start_time ) || range . include? ( other . end_time - 1 . second ) overlaps << other end end end overlaps end
Returns an array of the other shifts for this event that this shift overlaps with timewise.
Returns an array of the other shifts for this event that this shift overlaps with timewise .