<commit_before># create_table "virtual_competitions", force: true do |t|
#   t.integer  "jumps_kind"
#   t.integer  "suits_kind"
#   t.integer  "places_id"
#   t.date     "period_from"
#   t.date     "period_to"
#   t.integer  "discipline"
#   t.integer  "discipline_parameter"
#   t.datetime "created_at"
#   t.datetime "updated_at"
#   t.string   "name"
#   t.integer  "virtual_comp_group_id"
# end
#
# add_index "virtual_competitions", ["places_id"], name: "index_virtual_competitions_on_places_id", using: :btree

class VirtualCompetition < ActiveRecord::Base
  belongs_to :place
  belongs_to :group,
             class_name: 'VirtualCompGroup',
             foreign_key: 'virtual_comp_group_id'
  has_many :virtual_comp_results

  enum jumps_kind: [:skydive, :base]
  enum suits_kind: [:wingsuit, :tracksuit]
  enum discipline: 
    [:time, :distance, :speed, :distance_in_time, :time_until_line]

  def self.by_track(track)
    competitions = VirtualCompetition.order(:name)
    competitions = competitions.tracksuit if track.wingsuit.tracksuit?
    competitions = competitions.wingsuit if track.wingsuit.wingsuit?
    # Blank place means worldwide (without filter)
    competitions = competitions.where(place_id: track.place_id) if track.place_id
    competitions = competitions.where('period_from <= ?', track.created_at)
    competitions = competitions.where('period_to >= ?', track.created_at)

    competitions
  end

  def reprocess_results
    virtual_comp_results.each do |x|
      VirtualCompWorker.perform_async(x.track_id)
    end
  end
end
<commit_msg>hotfix for worldwide online comps<commit_after># create_table "virtual_competitions", force: true do |t|
#   t.integer  "jumps_kind"
#   t.integer  "suits_kind"
#   t.integer  "places_id"
#   t.date     "period_from"
#   t.date     "period_to"
#   t.integer  "discipline"
#   t.integer  "discipline_parameter"
#   t.datetime "created_at"
#   t.datetime "updated_at"
#   t.string   "name"
#   t.integer  "virtual_comp_group_id"
# end
#
# add_index "virtual_competitions", ["places_id"], name: "index_virtual_competitions_on_places_id", using: :btree

class VirtualCompetition < ActiveRecord::Base
  belongs_to :place
  belongs_to :group,
             class_name: 'VirtualCompGroup',
             foreign_key: 'virtual_comp_group_id'
  has_many :virtual_comp_results

  enum jumps_kind: [:skydive, :base]
  enum suits_kind: [:wingsuit, :tracksuit]
  enum discipline: 
    [:time, :distance, :speed, :distance_in_time, :time_until_line]

  def self.by_track(track)
    competitions = VirtualCompetition.order(:name)
    competitions = competitions.tracksuit if track.wingsuit.tracksuit?
    competitions = competitions.wingsuit if track.wingsuit.wingsuit?
    # Blank place means worldwide (without filter)
    competitions = competitions.where(
      'place_id = ? OR place_id IS NULL', track.place_id
    ) if track.place_id
    competitions = competitions.where('period_from <= ?', track.created_at)
    competitions = competitions.where('period_to >= ?', track.created_at)

    competitions
  end

  def reprocess_results
    virtual_comp_results.each do |x|
      VirtualCompWorker.perform_async(x.track_id)
    end
  end
end

{'fraction_non_alphanumeric': 0.1050656660412758, 'fraction_numerical': 0.0, 'mean_word_length': 4.134831460674158, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6591910', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1083, 'n_words': 219}