Sha256: 2286eac5e15a91ec58f77619b56489c9d10c70a5782652659df6cf3bb7109993

Contents?: true

Size: 1.29 KB

Versions: 24

Compression:

Stored size: 1.29 KB

Contents

class SlicesController < ArtfullyOseController
  before_filter :load_statement

  def index
    @select_options = [ 
                        ["", ""],
                        ["Location",                "order_location_proc"],
                        ["Payment Method",          "payment_method_proc"],
                        ["Ticket Type",             "ticket_type_proc"],
                        ["Discount",                "discount_code_proc"],
                        ["First time/Repeat",       "first_time_buyer_proc"]
                      ]
  end

  #
  # TODO TODO TODO
  # - Dollar amounts on ticket types
  # - Select all drop downs then de-select them
  #

  def data    
    # convert URL string slice[] into procs
    slices = Array.wrap(params[:slice]).map { |s| Slices.send(s) }
    data = Slicer.slice(Slice.new("All Sales"), @items, slices)

    respond_to do |format|
      format.json { render :json => data.children }
    end
  end

  def load_statement
    @show = Show.includes(:event, :tickets => [:items => :order]).find(params[:statement_id])
    @total_tickets = @show.tickets.select{|t| t.sold?}.size + @show.tickets.select{|t| t.comped?}.size
    authorize! :view, @show.event
    @items = Item.includes(:product, :order, :show => :event).where(:show_id => params[:statement_id])
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.23 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.21 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.20 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.19 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.18 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.17 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.16 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.15 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.12 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.11 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.10 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.9 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.8 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.7 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.6 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.5 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.4 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.3 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.2 app/controllers/slices_controller.rb
artfully_ose-1.2.0.pre.1 app/controllers/slices_controller.rb