<commit_before>class Schedule < ActiveRecord::Base
  belongs_to :person, polymorphic: true

  validates_numericality_of :day, only_integer: true,
                                  greater_than_or_equal_to: 1, less_than_or_equal_to: 5
  validates_numericality_of :hour, only_integer: true,
                                   greater_than_or_equal_to: 0, less_than_or_equal_to: 23
  validates_numericality_of :minute, only_integer: true,
                                     greater_than_or_equal_to: 0, less_than_or_equal_to: 59

  validates_uniqueness_of :person_id, scope: [:person_type, :day, :hour, :minute]

  validates_presence_of :person

  # overwrite == to simplificate comparison of collections
  def ==(other)
    other.is_a?(Schedule) &&
      day == other.day && hour == other.hour && minute == other.minute
  end

  # builds schedule entries for one week ordered by time
  # returns an array containing arrays for each day
  # [ [schedule_day_1, another_schedule_day_1 ]
  #   [schedule_day_2, another_schedule_day_2 ] ]
  def self.build_week
    (1..5).map do |day|
      (13..19).map do |hour|
        minutes = (hour == 19) ? [0] : [0, 30] # 19:30 does not exist
        minutes.map do |minute|<commit_msg>narrower scheduling possibilities<commit_after>class Schedule < ActiveRecord::Base
  belongs_to :person, polymorphic: true

  validates_numericality_of :day, only_integer: true,
                                  greater_than_or_equal_to: 1, less_than_or_equal_to: 5
  validates_numericality_of :hour, only_integer: true,
                                   greater_than_or_equal_to: 0, less_than_or_equal_to: 23
  validates_numericality_of :minute, only_integer: true,
                                     greater_than_or_equal_to: 0, less_than_or_equal_to: 59

  validates_uniqueness_of :person_id, scope: [:person_type, :day, :hour, :minute]

  validates_presence_of :person

  BEGIN_HOUR = 13
  END_HOUR = 18

  # overwrite == to simplificate comparison of collections
  def ==(other)
    other.is_a?(Schedule) &&
      day == other.day && hour == other.hour && minute == other.minute
  end

  # builds schedule entries for one week ordered by time
  # returns an array containing arrays for each day
  # [ [schedule_day_1, another_schedule_day_1 ]
  #   [schedule_day_2, another_schedule_day_2 ] ]
  def self.build_week
    (1..5).map do |day|
      (BEGIN_HOUR..END_HOUR).map do |hour|
        [0, 30].map do |minute|
{'fraction_non_alphanumeric': 0.08882521489971347, 'fraction_numerical': 0.02005730659025788, 'mean_word_length': 3.0197368421052633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6776963', 'n_tokens_mistral': 831, 'n_tokens_neox': 774, 'n_words': 192}