def conflicts
      conflicts = Tableau::ClassArray.new

      (0..4).each do |day|
        days_classes = self.classes_for_day(day)
        next if !days_classes || days_classes.count == 0

        # get the last element index
        last = days_classes.count - 1

        for i in 0..last
          i_c = days_classes[i]
          time_range = i_c.time..(i_c.time + 3600 * i_c.duration)

          for j in (i+1)..last
            if time_range.cover?(days_classes[j].time)
              conflicts << [days_classes[i], days_classes[j]]
            end
          end
        end
      end
      conflicts # return the conflicts
    end
def conflicts
      conflicts = Tableau::ClassArray.new

      (0..4).each do |day|
        days_classes = self.classes_for_day(day)
        next if !days_classes || days_classes.count == 0

        # get the last element index
        last = days_classes.count - 1

        for i in 0..last
          i_c = days_classes[i]
          time_range = i_c.time..(i_c.time + 3600 * i_c.duration)

          for j in (i+1)..last
            if time_range.cover?(days_classes[j].time)
              conflicts << [days_classes[i], days_classes[j]]
            end
          end
        end
      end
      conflicts # return the conflicts
    end
def conflicts conflicts = Tableau :: ClassArray . new ( 0 .. 4 ) . each do | day | days_classes = self . classes_for_day ( day ) next if ! days_classes || days_classes . count == 0 # get the last element index last = days_classes . count - 1 for i in 0 .. last i_c = days_classes [ i ] time_range = i_c . time .. ( i_c . time + 3600 * i_c . duration ) for j in ( i + 1 ) .. last if time_range . cover? ( days_classes [ j ] . time ) conflicts << [ days_classes [ i ] , days_classes [ j ] ] end end end end conflicts # return the conflicts end
Returns an array of time conflicts found in the timetable
Returns an array of time conflicts found in the timetable