<commit_before>class ResponseSet < ActiveRecord::Base
  include Surveyor::Models::ResponseSetMethods
  include AASM

  before_save :generate_certificate
  after_destroy :destroy_dataset_if_no_repsonses

  attr_accessible :dataset_id

  belongs_to :dataset
  belongs_to :survey
  has_one :certificate

  # there is already a protected method with this
  # has_many :dependencies, :through => :survey

  aasm do
    state :in_progress, :initial => true
    state :completed
    state :published
    state :archived

    # not yet used
    # (also, clash with complete/incomplete)
    #
    # event :complete do
    #   transitions from: :in_progress, to: :completed
    # end
    #
    # event :uncomplete do
    #   transitions from: :completed, to: :in_progress
    # end
    #
    # event :publish do
    #   transitions from: :completed, to: :published
    # end
    #
    # event :archive do
    #   transitions from: :published, to: :archived
    # end<commit_msg>switched to draft/published/archived states - touch #361<commit_after>class ResponseSet < ActiveRecord::Base
  include Surveyor::Models::ResponseSetMethods
  include AASM

  before_save :generate_certificate
  after_destroy :destroy_dataset_if_no_repsonses

  attr_accessible :dataset_id

  belongs_to :dataset
  belongs_to :survey
  has_one :certificate

  # there is already a protected method with this
  # has_many :dependencies, :through => :survey

  aasm do
    state :draft, :initial => true
    state :published
    state :archived

    # not yet used
    #
    # event :publish do
    #   transitions from: :draft, to: :published
    # end
    #
    # event :archive do
    #   transitions from: :published, to: :archived
    # end
{'fraction_non_alphanumeric': 0.07840842598010532, 'fraction_numerical': 0.0017554125219426564, 'mean_word_length': 3.2964824120603016, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6508354', 'n_tokens_mistral': 534, 'n_tokens_neox': 518, 'n_words': 152}