<commit_before>class CertificationCampaign < ActiveRecord::Base
  include Ownership

  attr_accessor :version
  attr_writer :limit

  validates :name, uniqueness: true, presence: true
  validates :url, :jurisdiction, presence: true, if: :validate_extra_details?
  validates :limit, numericality: { greater_than: 0 }, allow_blank: true

  has_many :certificate_generators
  belongs_to :user

  attr_accessible :name, :limit, :url, :jurisdiction, :version, :subset

  serialize :subset

  def total_count
    generated_count
  end

  def generated_count
    current.count
  end

  def published_count
    current.published.count
  end
<commit_msg>adds a default empty value for subset<commit_after>class CertificationCampaign < ActiveRecord::Base
  include Ownership

  attr_accessor :version
  attr_writer :limit

  validates :name, uniqueness: true, presence: true
  validates :url, :jurisdiction, presence: true, if: :validate_extra_details?
  validates :limit, numericality: { greater_than: 0 }, allow_blank: true

  has_many :certificate_generators
  belongs_to :user

  attr_accessible :name, :limit, :url, :jurisdiction, :version, :subset

  serialize :subset

  def subset
    s=read_attribute(:subset)
    return s.blank? ? {} : s
  end

  def total_count
    generated_count
  end

  def generated_count
    current.count
  end

  def published_count
    current.published.count
  end

{'fraction_non_alphanumeric': 0.07465900933237617, 'fraction_numerical': 0.0014357501794687725, 'mean_word_length': 4.466666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2870601', 'n_tokens_mistral': 447, 'n_tokens_neox': 415, 'n_words': 121}