<commit_before>class Event < ActiveRecord::Base
  include Listable
  include Invitable

  attr_accessor :begins_at
  resourcify :permissions, role_cname: 'Permission', role_table_name: :permission

  belongs_to :venue, class_name: 'Sponsor'
  has_many :sponsorships
  has_many :sponsors, through: :sponsorships
  has_many :organisers, -> { where('permissions.name' => 'organiser') }, through: :permissions, source: :members

  has_and_belongs_to_many :chapters

  has_many :invitations

  validates :name, :slug, :info, :schedule, :description, presence: true
  validates :slug, uniqueness: true

  validate :invitability, if: :invitable?

  validates :coach_spaces, :student_spaces, numericality: true
  attr_accessor :publish_day, :publish_time

  before_save do
    begins_at = Time.parse(self.begins_at)
    self.date_and_time = date_and_time.change(hour: begins_at.hour, min: begins_at.min)
  end

  def to_s
    name
  end

  def to_param
    slug
  end

  def verified_coaches
    invitations.coaches.accepted.verified.map(&:member)
  end

  def verified_students
    invitations.students.accepted.verified.map(&:member)
  end

  def coaches_only?
    student_spaces == 0
  end

  def students_only?
    coach_spaces == 0
  end

  def coach_spaces?
    !students_only? && coach_spaces > attending_coaches.count
  end

  def student_spaces?
    !coaches_only? && student_spaces > attending_students.count
  end

  def date
    I18n.l(date_and_time, format: :dashboard)
  end

  def update_date_and_time
    self.date_and_time = date_and_time.change(hour: time.hour, min: time.min)
  end

  def invitability
    errors.add(:coach_spaces, 'must be set') if coach_spaces.blank?
    errors.add(:student_space, 'must be set') if student_spaces.blank?
    errors.add(:invitable, 'Fill in all invitations details to make the event invitable') \
      unless coach_spaces.present? && student_spaces.present?
  end

  def student_emails
    invitations.students.where(attending: true).map { |i| i.member.email }
  end

  def coach_emails
    invitations.coaches.where(attending: true).map { |i| i.member.email }
  end<commit_msg>Event remove unused method<commit_after>class Event < ActiveRecord::Base
  include Listable
  include Invitable

  attr_accessor :begins_at
  resourcify :permissions, role_cname: 'Permission', role_table_name: :permission

  belongs_to :venue, class_name: 'Sponsor'
  has_many :sponsorships
  has_many :sponsors, through: :sponsorships
  has_many :organisers, -> { where('permissions.name' => 'organiser') }, through: :permissions, source: :members

  has_and_belongs_to_many :chapters

  has_many :invitations

  validates :name, :slug, :info, :schedule, :description, presence: true
  validates :slug, uniqueness: true

  validate :invitability, if: :invitable?

  validates :coach_spaces, :student_spaces, numericality: true
  attr_accessor :publish_day, :publish_time

  before_save do
    begins_at = Time.parse(self.begins_at)
    self.date_and_time = date_and_time.change(hour: begins_at.hour, min: begins_at.min)
  end

  def to_s
    name
  end

  def to_param
    slug
  end

  def verified_coaches
    invitations.coaches.accepted.verified.map(&:member)
  end

  def verified_students
    invitations.students.accepted.verified.map(&:member)
  end

  def coaches_only?
    student_spaces == 0
  end

  def students_only?
    coach_spaces == 0
  end

  def coach_spaces?
    !students_only? && coach_spaces > attending_coaches.count
  end

  def student_spaces?
    !coaches_only? && student_spaces > attending_students.count
  end

  def date
    I18n.l(date_and_time, format: :dashboard)
  end

  def invitability
    errors.add(:coach_spaces, 'must be set') if coach_spaces.blank?
    errors.add(:student_space, 'must be set') if student_spaces.blank?
    errors.add(:invitable, 'Fill in all invitations details to make the event invitable') \
      unless coach_spaces.present? && student_spaces.present?
  end

  def student_emails
    invitations.students.where(attending: true).map { |i| i.member.email }
  end

  def coach_emails
    invitations.coaches.where(attending: true).map { |i| i.member.email }
  end
{'fraction_non_alphanumeric': 0.09294485913797255, 'fraction_numerical': 0.001926318324103058, 'mean_word_length': 4.21859296482412, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7514664', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1392, 'n_words': 326}