Sha256: 6bc60282c03dcb529a6bbdb333d0a75a0d0537302b4e395f375c7c3757c0daa6

Contents?: true

Size: 429 Bytes

Versions: 37

Compression:

Stored size: 429 Bytes

Contents

class SectionSummary
  attr_accessor :total, :sold, :comped, :available
  
  def self.for_tickets(tickets = [])
    summary = SectionSummary.new
    summary.total = tickets.size
    summary.sold = tickets.select{|t| t.sold?}.size
    summary.comped = tickets.select{|t| t.comped?}.size
    summary.available = tickets.select{|t| t.on_sale?}.size
    summary
  end
  
  def off_sale
    total - available - sold - comped
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
artfully_ose-1.3.0.pre4 app/models/section_summary.rb
artfully_ose-1.3.0.pre3 app/models/section_summary.rb
artfully_ose-1.3.0.pre2 app/models/section_summary.rb
artfully_ose-1.3.0.pre1 app/models/section_summary.rb
artfully_ose-1.2.0 app/models/section_summary.rb
artfully_ose-1.2.0.beta.1 app/models/section_summary.rb
artfully_ose-1.2.0.alpha.2 app/models/section_summary.rb
artfully_ose-1.2.0.alpha.1 app/models/section_summary.rb
artfully_ose-1.2.0.pre.27 app/models/section_summary.rb
artfully_ose-1.2.0.pre.26 app/models/section_summary.rb
artfully_ose-1.2.0.pre.24 app/models/section_summary.rb
artfully_ose-1.2.0.pre.23 app/models/section_summary.rb
artfully_ose-1.2.0.pre.21 app/models/section_summary.rb
artfully_ose-1.2.0.pre.20 app/models/section_summary.rb
artfully_ose-1.2.0.pre.19 app/models/section_summary.rb
artfully_ose-1.2.0.pre.18 app/models/section_summary.rb
artfully_ose-1.2.0.pre.17 app/models/section_summary.rb
artfully_ose-1.2.0.pre.16 app/models/section_summary.rb
artfully_ose-1.2.0.pre.15 app/models/section_summary.rb
artfully_ose-1.2.0.pre.12 app/models/section_summary.rb