modify controllers and models to just save paid ticket purchases
This commit is contained in:
parent
900a1b32a8
commit
81ef41be8b
4 changed files with 25 additions and 17 deletions
|
|
@ -28,8 +28,10 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@total_price = Ticket.total_price(@conference, current_user)
|
||||
TicketPurchase.destroy_all(user_id: current_user.id, conference_id: @conference.id, paid: 'f')
|
||||
@total_price = Ticket.total_price(@conference, current_user, 't')
|
||||
@tickets = current_user.ticket_purchases.where(conference_id: @conference.id)
|
||||
@ticket_payments = @tickets.group_by(&:payment_id)
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
|
|
|||
|
|
@ -6,9 +6,8 @@ class TicketPurchasesController < ApplicationController
|
|||
def create
|
||||
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
||||
if message.blank?
|
||||
if current_user.ticket_purchases.any?
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
notice: "Thank you for supporting #{@conference.title} by purchasing a ticket."
|
||||
if current_user.ticket_purchases.where(paid: 'f').any?
|
||||
redirect_to new_conference_payment_path, notice: 'Please pay here to purchase tickets.'
|
||||
else
|
||||
redirect_to conference_conference_registration_path(@conference.short_title)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue