fixed failing tests
This commit is contained in:
parent
86cab52f52
commit
0ec937e43e
2 changed files with 6 additions and 2 deletions
|
|
@ -62,7 +62,11 @@ class Ticket < ApplicationRecord
|
||||||
|
|
||||||
def tickets_turnover_total(id)
|
def tickets_turnover_total(id)
|
||||||
tickets = TicketPurchase.where(ticket_id: id).paid
|
tickets = TicketPurchase.where(ticket_id: id).paid
|
||||||
tickets.inject(Money.new(0,tickets.first.price_currency)){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
|
if tickets.nil?
|
||||||
|
tickets.inject(Money.new(0, tickets.first.price_currency)){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
|
||||||
|
else
|
||||||
|
Money.new(0, Ticket.find(id).price_currency)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tickets_sold
|
def tickets_sold
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,7 @@ ActiveRecord::Schema.define(version: 20171201163628) do
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "payment_id"
|
t.integer "payment_id"
|
||||||
t.integer "week"
|
t.integer "week"
|
||||||
t.float "amount_paid"
|
t.float "amount_paid", default: 0.0
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "ticket_scannings", force: :cascade do |t|
|
create_table "ticket_scannings", force: :cascade do |t|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue