mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
currency of a single ticket could be updated now
closes #1913 fixed travis faliures minor changes removed empty file added tests regarding currency updation
This commit is contained in:
parent
769cc6c970
commit
33d32b9294
2 changed files with 25 additions and 1 deletions
|
|
@ -76,7 +76,9 @@ class Ticket < ApplicationRecord
|
|||
private
|
||||
|
||||
def tickets_of_conference_have_same_currency
|
||||
unless Ticket.where(conference_id: conference_id).all?{|t| t.price_currency == price_currency }
|
||||
tickets = Ticket.where(conference_id: conference_id)
|
||||
return if tickets.count.zero? || (tickets.count == 1 && self == tickets.first)
|
||||
unless tickets.all?{|t| t.price_currency == price_currency }
|
||||
errors.add(:price_currency, 'is different from the existing tickets of this conference.')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue