<commit_before># frozen_string_literal: true

FactoryGirl.define do
  factory :incident do
    association :driver, factory: :user
    motor_vehicle_collision false
    passenger_incident false
    completed true
    run                        { "Run #{rand 20}" }
    block                      { "Block #{rand 20}" }
    bus                        { 3_000 + 100 * rand(3) + rand(30) }
    occurred_at                { DateTime.now }
    passengers_onboard         { rand 40 }
    courtesy_cards_distributed { rand 5 }
    courtesy_cards_collected   { rand 5 }
    speed                      { rand 40 }
    location                   { FFaker::Address.street_name }
    town                       { %w[Amherst Northampton Springfield].sample }
    weather_conditions         { Incident::WEATHER_OPTIONS.sample }
    road_conditions            { Incident::ROAD_OPTIONS.sample }
    light_conditions           { Incident::LIGHT_OPTIONS.sample }
    description                { FFaker::BaconIpsum.paragraphs(5).join "\n" }
  end

  trait :collision do
    motor_vehicle_collision true
    other_vehicle_owned_by_other_driver true # so that we don't need all those fields
    police_on_scene false # so that we don't need those fields
    other_vehicle_plate                     { FFaker::String.from_regexp(/\A\d[A-Z][A-Z][A-Z]\d{2}\Z/) }
    other_vehicle_state                     { %w[MA RI CT NY].sample }<commit_msg>Use beginning_of_minute<commit_after># frozen_string_literal: true

FactoryGirl.define do
  factory :incident do
    association :driver, factory: :user
    motor_vehicle_collision false
    passenger_incident false
    completed true
    run                        { "Run #{rand 20}" }
    block                      { "Block #{rand 20}" }
    bus                        { 3_000 + 100 * rand(3) + rand(30) }
    occurred_at                { DateTime.now.beginning_of_minute }
    passengers_onboard         { rand 40 }
    courtesy_cards_distributed { rand 5 }
    courtesy_cards_collected   { rand 5 }
    speed                      { rand 40 }
    location                   { FFaker::Address.street_name }
    town                       { %w[Amherst Northampton Springfield].sample }
    weather_conditions         { Incident::WEATHER_OPTIONS.sample }
    road_conditions            { Incident::ROAD_OPTIONS.sample }
    light_conditions           { Incident::LIGHT_OPTIONS.sample }
    description                { FFaker::BaconIpsum.paragraphs(5).join "\n" }
  end

  trait :collision do
    motor_vehicle_collision true
    other_vehicle_owned_by_other_driver true # so that we don't need all those fields
    police_on_scene false # so that we don't need those fields
    other_vehicle_plate                     { FFaker::String.from_regexp(/\A\d[A-Z][A-Z][A-Z]\d{2}\Z/) }
    other_vehicle_state                     { %w[MA RI CT NY].sample }
{'fraction_non_alphanumeric': 0.08182451253481894, 'fraction_numerical': 0.01532033426183844, 'mean_word_length': 1.9466666666666668, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1333386', 'n_tokens_mistral': 883, 'n_tokens_neox': 808, 'n_words': 185}