Sha256: b8ba1c84d30dc693499c305d31867563eb66bd9f4d355a1396c95ea6074163ef
Contents?: true
Size: 1.22 KB
Versions: 20
Compression:
Stored size: 1.22 KB
Contents
# # This needs to be refactored to be less database intensive # module Ticket::Reports class Base def initialize(parent) @parent = parent end def self.reporting_methods self.public_instance_methods - Object.public_instance_methods end private def parent @parent end def tickets parent.send(:tickets) end end class Available < Base def total tickets.select(&:on_sale?).length end end class Sold < Base def total tickets.select(&:sold?).length end def today tickets.sold_after(Time.now.beginning_of_day).count end def played tickets.sold.played.count end end class Comped < Base def total tickets.select(&:comped?).length end def today tickets.comped.sold_after(Time.now.beginning_of_day).count end def played tickets.comped.played.count end end class Sales < Base def total tickets.sold.sum(:sold_price) end def today tickets.sold_after(Time.now.beginning_of_day).sum(:sold_price) end def played tickets.sold.played.sum(:sold_price) end def advance tickets.sold.unplayed.sum(:sold_price) end end end
Version data entries
20 entries across 20 versions & 1 rubygems