Sha256: 7dcaa852dd1e8107b54e6fcf33e59b26a558d14b477645b6628c6dab67ec8a01

Contents?: true

Size: 657 Bytes

Versions: 3

Compression:

Stored size: 657 Bytes

Contents

module MissingText
  class Batch < ActiveRecord::Base

    has_many :missing_text_records
    has_many :missing_text_warnings

    # every batch except this one
    def self.history_options(batch)
      MissingText::Batch.where("id != ?", batch.id).order('created_at DESC')
    end

    def created_time
      self.created_at.strftime('%b %e, %Y at %H:%M:%S')
    end

    def high_entry_count
      500
    end

    def entries
      MissingText::Entry.where("missing_text_records_id in (?)", MissingText::Record.where(missing_text_batch_id: self.id).pluck(:id))
    end

    def high_entry_count?
      entries.count >= high_entry_count
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
missing_text-1.0.2 app/models/missing_text/batch.rb
missing_text-1.0.1 app/models/missing_text/batch.rb
missing_text-1.0.0 app/models/missing_text/batch.rb