Sha256: db2362c3e0befc08c732f0228e0b1aabc64f742e9ba20dc80f10c8f2641c8351

Contents?: true

Size: 593 Bytes

Versions: 44

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

require "attr_extras"
require_dependency "renalware/hd"

module Renalware
  module HD
    module SessionForms
      class Batch < ApplicationRecord
        include Accountable

        enum status: { queued: 0, processing: 10, awaiting_printing: 15, failure: 20, success: 30 }

        has_many(
          :items,
          dependent: :restrict_with_exception,
          class_name: "BatchItem"
        )

        def percent_complete
          ((items.where(status: :compiled).count.to_f / batch_items_count) * 100).ceil
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
renalware-core-2.0.159 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.158 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.157 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.156 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.155 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.153 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.152 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.151 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.149 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.148 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.147 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.146 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.145 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.144 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.143 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.142 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.141 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.140 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.139 app/models/renalware/hd/session_forms/batch.rb
renalware-core-2.0.138 app/models/renalware/hd/session_forms/batch.rb