<commit_before>class UserSeenSubject < ActiveRecord::Base
  belongs_to :user
  belongs_to :workflow

  validates_presence_of :user, :workflow

  attr_accessible :user_id, :workflow_id

  class InvalidSubjectIdError < StandardError; end

  def self.add_seen_subject_for_user(user_id:, workflow_id:, subject_id:)
    uss = self.find_or_create_by!(user_id: user_id, workflow_id: workflow_id)
    uss.add_subject_id(subject_id)
  end

  def add_subject_id(subject_id)
    unless Subject.exists?(subject_id)
      raise InvalidSubjectIdError.new("Subject ID is invalid, possibly not persisted.")
    end
    subject_ids_will_change!<commit_msg>use ruby 2.0 keyword compatability<commit_after>class UserSeenSubject < ActiveRecord::Base
  belongs_to :user
  belongs_to :workflow

  validates_presence_of :user, :workflow

  attr_accessible :user_id, :workflow_id

  class InvalidSubjectIdError < StandardError; end

  def self.add_seen_subject_for_user(user_id: nil, workflow_id: nil, subject_id: nil)
    uss = self.find_or_create_by!(user_id: user_id, workflow_id: workflow_id)
    uss.add_subject_id(subject_id)
  end

  def add_subject_id(subject_id)
    unless Subject.exists?(subject_id)
      raise InvalidSubjectIdError.new("Subject ID is invalid, possibly not persisted.")
    end
    subject_ids_will_change!
{'fraction_non_alphanumeric': 0.07551487414187644, 'fraction_numerical': 0.0015255530129672007, 'mean_word_length': 5.463054187192118, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6488177', 'n_tokens_mistral': 453, 'n_tokens_neox': 431, 'n_words': 90}