Rebuild rubocop TODOs after auto-correcting

This commit is contained in:
James Mason 2018-04-04 10:18:51 -07:00
parent 31c50255e9
commit 84dbb52d11
No known key found for this signature in database
GPG key ID: 1B3951886C449023
580 changed files with 3689 additions and 3133 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Ticket < ApplicationRecord
belongs_to :conference
has_many :ticket_purchases, dependent: :destroy
@ -58,7 +60,7 @@ class Ticket < ApplicationRecord
def self.total_price_user(conference, user, paid: false)
tickets = TicketPurchase.where(conference: conference, user: user, paid: paid)
tickets.inject(0){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
tickets.inject(0) { |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) }
end
def tickets_turnover_total(id)
@ -77,8 +79,6 @@ class Ticket < ApplicationRecord
def tickets_of_conference_have_same_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
errors.add(:price_currency, 'is different from the existing tickets of this conference.') unless tickets.all? { |t| t.price_currency == price_currency }
end
end