[fix] Fix check for non-free tickets

This commit is contained in:
Jimmy 2021-03-04 16:32:36 -08:00
parent 7d70462542
commit a599980046

View file

@ -22,13 +22,6 @@ class TicketPurchasesController < ApplicationController
return return
end end
# Ticket purchase created but not paid
if current_user.ticket_purchases.by_conference(@conference).unpaid.any?
redirect_to new_conference_payment_path,
notice: 'Please pay here to get tickets.'
return
end
# Current user already paid for a registration ticket and the current ticket purchase contains one # Current user already paid for a registration ticket and the current ticket purchase contains one
if count_registration_tickets_before == 1 && count_registration_tickets_after > 1 if count_registration_tickets_before == 1 && count_registration_tickets_after > 1
redirect_to conference_physical_tickets_path, redirect_to conference_physical_tickets_path,
@ -44,10 +37,17 @@ class TicketPurchasesController < ApplicationController
return return
end end
# Ticket purchase created but not paid
if current_user.ticket_purchases.by_conference(@conference).unpaid.any?
redirect_to new_conference_payment_path,
notice: 'Please pay here to get tickets.'
return
end
# Current user didn't have a registration ticket and is purchasing one # Current user didn't have a registration ticket and is purchasing one
if count_registration_tickets_before == 0 && count_registration_tickets_after == 1 if count_registration_tickets_before == 0 && count_registration_tickets_after == 1
redirect_to new_conference_conference_registration_path(@conference.short_title) redirect_to new_conference_conference_registration_path(@conference.short_title)
else else
redirect_to conference_physical_tickets_path redirect_to conference_physical_tickets_path
end end
end end