mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add turnover for admin
Admin can see the turnover amount for each ticket type.
This commit is contained in:
parent
0d70832f5b
commit
03c9f7deb1
3 changed files with 7 additions and 6 deletions
|
|
@ -496,7 +496,7 @@ class Conference < ActiveRecord::Base
|
|||
if tickets && ticket_purchases
|
||||
tickets.each do |ticket|
|
||||
result[ticket.title] = {
|
||||
'value' => ApplicationController.helpers.humanized_money(ticket.tickets_turnover).delete(',').to_i,
|
||||
'value' => ApplicationController.helpers.humanized_money(ticket.tickets_turnover_total(ticket.id)).delete(',').to_i,
|
||||
'color' => "\##{Digest::MD5.hexdigest(ticket.title)[0..5]}"
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -60,12 +60,13 @@ class Ticket < ActiveRecord::Base
|
|||
tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
|
||||
end
|
||||
|
||||
def tickets_sold
|
||||
ticket_purchases.paid.sum(:quantity)
|
||||
def tickets_turnover_total(id)
|
||||
tickets = TicketPurchase.where(ticket_id: id)
|
||||
tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
|
||||
end
|
||||
|
||||
def tickets_turnover
|
||||
tickets_sold * price
|
||||
def tickets_sold
|
||||
ticket_purchases.paid.sum(:quantity)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
%td
|
||||
= ticket.tickets_sold
|
||||
%td
|
||||
= humanized_money_with_symbol ticket.tickets_turnover
|
||||
= humanized_money_with_symbol ticket.tickets_turnover_total(ticket.id)
|
||||
%td
|
||||
= ticket.registration_ticket? ? 'Yes' : 'No'
|
||||
%td
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue