<commit_before>module Turducken
  class Job
    include Mongoid::Document
    include Mongoid::Timestamps
    include Stateflow
    Stateflow.persistence = :mongoid #TODO find better way of doing this. maybe gem load order?

    field :hit_title
    field :hit_description
    field :hit_question_type # this should be either 'external' or 'questionform'
    field :hit_id
    field :hit_type_id
    field :hit_url
    field :hit_reward, type: Float
    field :hit_num_assignments, type: Integer
    field :hit_lifetime_s, type: Integer
    field :hit_question, type: String

    field :complete, type: Boolean
    field :state

    

    has_many :assignments, :class_name => 'Turducken::Assignment'
  #  has_many :workers, :through => :assignments

    class_attribute :attributes_defaults
    self.attributes_defaults = {}
    def self.set_defaults(attrs = {})
      self.attributes_defaults = self.attributes_defaults.merge(attrs)
    end
    def initialize(attributes = {})
      super(self.attributes_defaults.merge(attributes))
    end
    
    class_attribute :qualifications
    self.qualifications = []
    def self.qualification(symbol, hash)
      self.qualifications << [symbol, hash]
    end

    after_create do
      launch!<commit_msg>added options argument to Turducken:Job#initialize, neede for calling create<commit_after>module Turducken
  class Job
    include Mongoid::Document
    include Mongoid::Timestamps
    include Stateflow
    Stateflow.persistence = :mongoid #TODO find better way of doing this. maybe gem load order?

    field :hit_title
    field :hit_description
    field :hit_question_type # this should be either 'external' or 'questionform'
    field :hit_id
    field :hit_type_id
    field :hit_url
    field :hit_reward, type: Float
    field :hit_num_assignments, type: Integer
    field :hit_lifetime_s, type: Integer
    field :hit_question, type: String

    field :complete, type: Boolean
    field :state

    

    has_many :assignments, :class_name => 'Turducken::Assignment'
  #  has_many :workers, :through => :assignments

    class_attribute :attributes_defaults
    self.attributes_defaults = {}
    def self.set_defaults(attrs = {})
      self.attributes_defaults = self.attributes_defaults.merge(attrs)
    end
    def initialize(attributes = {}, options = {})
      super(self.attributes_defaults.merge(attributes), options)
    end
    
    class_attribute :qualifications
    self.qualifications = []
    def self.qualification(symbol, hash)
      self.qualifications << [symbol, hash]
    end

    after_create do
      launch!
{'fraction_non_alphanumeric': 0.08030888030888031, 'fraction_numerical': 0.0, 'mean_word_length': 3.5218150087260036, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2237634', 'n_tokens_mistral': 746, 'n_tokens_neox': 746, 'n_words': 203}