Fix tickets turnover calculation

This commit is contained in:
Michael Klimenko 2018-03-24 01:24:49 +05:00
parent 0c6d1fa233
commit cc9b3e1a6b
No known key found for this signature in database
GPG key ID: 8104804717433984
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