Fix tickets turnover calculation

This commit is contained in:
Michael Klimenko 2018-03-24 01:24:49 +05:00 committed by James Mason
parent 69de418ccd
commit 58cb62dd6d
3 changed files with 20 additions and 6 deletions

View file

@ -69,6 +69,11 @@ class TicketPurchase < ApplicationRecord
purchase
end
# Total amount
def self.total
sum('amount_paid * quantity')
end
def pay(payment)
update_attributes(paid: true, payment: payment)
PhysicalTicket.transaction do