Add total amount spent by user

User can see the total amount that he paid for the tickets and total amount spent by him on each ticket
This commit is contained in:
rahul 2017-09-25 00:52:13 +05:30
parent b761e83b45
commit 0d70832f5b
4 changed files with 10 additions and 4 deletions

View file

@ -27,8 +27,9 @@ class ConferenceRegistrationsController < ApplicationController
end
def show
@total_price = Ticket.total_price(@conference, current_user, paid: true)
@total_price = Ticket.total_price_user(@conference, current_user, paid: true)
@tickets = current_user.ticket_purchases.by_conference(@conference).paid
@total_price_per_ticket = @tickets.group(:ticket_id).sum('amount_paid * quantity')
@ticket_payments = @tickets.group_by(&:ticket_id)
@total_quantity = @tickets.group(:ticket_id).sum(:quantity)
end