<commit_before># Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
  factory :reservation do
    start_date { Date.today }
    due_date { Date.tomorrow }
    reserver
    equipment_model

    factory :valid_reservation do
      after(:build) { |res| res.equipment_object = FactoryGirl.create(:equipment_object, equipment_model: res.equipment_model) }

      factory :checked_out_reservation do
        checked_out { Date.today }
        checkout_handler
      end

      factory :checked_in_reservation do
        start_date { Date.yesterday }
        due_date { Date.today }
        checked_out { Date.yesterday }
        checked_in { Date.today }
        checkout_handler
        checkin_handler
      end

      factory :overdue_reservation do
        start_date { Date.yesterday - 1 }
        due_date { Date.yesterday }
        checked_out { Date.yesterday - 1 }
        checkout_handler
      end

      factory :missed_reservation do
        start_date { Date.yesterday - 1 }
        due_date { Date.yesterday }
      end
    end
  end
end
<commit_msg>bugfix in reservation factory<commit_after># Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
  factory :reservation do
    start_date { Date.today }
    due_date { Date.tomorrow }
    reserver
    equipment_model

    factory :valid_reservation do
      after(:build) do |res|
        if res.equipment_model.equipment_objects.empty?
          FactoryGirl.create(:equipment_object, equipment_model: res.equipment_model)
        end
      end

      factory :checked_out_reservation do
        checked_out { Date.today }
        checkout_handler
        after(:build) { |res| res.equipment_object = res.equipment_model.equipment_objects.first }

        factory :checked_in_reservation do
          start_date { Date.yesterday }
          due_date { Date.today }
          checked_out { Date.yesterday }
          checked_in { Date.today }
          checkin_handler
        end

        factory :overdue_reservation do
          start_date { Date.yesterday - 1 }
          due_date { Date.yesterday }
          checked_out { Date.yesterday - 1 }
        end
      end

      factory :missed_reservation do
        start_date { Date.yesterday - 1 }
        due_date { Date.yesterday }
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.06635474266269673, 'fraction_numerical': 0.002552105487026797, 'mean_word_length': 2.2849162011173183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6694687', 'n_tokens_mistral': 732, 'n_tokens_neox': 690, 'n_words': 153}