ticket_purchase_controller: free ticket routing

This commit is contained in:
Rishabh Saxena 2016-08-19 00:51:49 +05:30
parent b28be23284
commit b36d4e98e2
No known key found for this signature in database
GPG key ID: FA3BDC38A9CB6807
2 changed files with 9 additions and 4 deletions

View file

@ -11,8 +11,13 @@ class TicketPurchasesController < ApplicationController
redirect_to new_conference_payment_path,
notice: 'Please pay here to get tickets.'
else
redirect_to conference_tickets_path(@conference.short_title),
error: 'Please get at least one ticket to continue.'
if current_user.ticket_purchases.by_conference(@conference).paid.any?
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'You have free tickets for the conference.'
else
redirect_to conference_tickets_path(@conference.short_title),
error: 'Please get at least one ticket to continue.'
end
end
else
redirect_to conference_conference_registration_path(@conference.short_title),