<commit_before>class SurveyAssignment < ActiveRecord::Base
  belongs_to :survey
  has_and_belongs_to_many :cohorts
  has_many :survey_notifications

  scope :published, -> { where(published:true)}

  def send_at
    {
      :days => send_date_days,
      :before => send_before,
      :relative_to => send_date_relative_to
    }
  end

  def courses_users_ready_for_survey
    courses = self.cohorts.collect { |cohort| cohort.courses.ready_for_survey(send_at) }.flatten
    courses.collect {|course| course.courses_users.where({ role: courses_user_role})}.flatten
  end
end<commit_msg>Survey method added to survey_assignment<commit_after>class SurveyAssignment < ActiveRecord::Base
  belongs_to :survey
  has_and_belongs_to_many :cohorts
  has_many :survey_notifications

  scope :published, -> { where(published:true)}

  def send_at
    {
      :days => send_date_days,
      :before => send_before,
      :relative_to => send_date_relative_to
    }
  end

  def courses_users_ready_for_survey
    courses = self.cohorts.collect { |cohort| cohort.courses.ready_for_survey(send_at) }.flatten
    courses.collect {|course| course.courses_users.where({ role: courses_user_role})}.flatten
  end

  def survey
    Survey.find(survey_id)
  end
end
{'fraction_non_alphanumeric': 0.09244372990353698, 'fraction_numerical': 0.0, 'mean_word_length': 4.343347639484978, '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': '643994', 'n_tokens_mistral': 434, 'n_tokens_neox': 425, 'n_words': 77}