Sha256: bff9d277970679383f1c33ce13c8ede42f04c880122f6ad9a2370960500ed178
Contents?: true
Size: 942 Bytes
Versions: 2
Compression:
Stored size: 942 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" module Renalware module Letters class Batch < ApplicationRecord include Accountable # TODO: I think these attributes are dead attr_accessor( :url, :enclosures_present, :notes_present, :state_eq, :author_id_eq, :created_by_id_eq, :letterhead_id_eq, :page_count_in_array, :s ) enum status: { queued: 0, processing: 10, awaiting_printing: 15, failure: 20, success: 30 } has_many( :items, dependent: :restrict_with_exception, class_name: "Renalware::Letters::BatchItem" ) has_many( :letters, through: :items, class_name: "Renalware::Letters::Letter" ) def percent_complete ((items.where(status: :compiled).count.to_f / batch_items_count) * 100).ceil end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
renalware-core-2.1.1 | app/models/renalware/letters/batch.rb |
renalware-core-2.1.0 | app/models/renalware/letters/batch.rb |