From 66a2777677284f7976f601bc46c7a9780b7779b0 Mon Sep 17 00:00:00 2001 From: ViditChitkara Date: Tue, 2 Jan 2018 19:29:28 +0530 Subject: [PATCH] changes for test faliures --- app/models/ticket.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 19f2f2f4..80e7f3e0 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -62,10 +62,10 @@ class Ticket < ApplicationRecord def tickets_turnover_total(id) tickets = TicketPurchase.where(ticket_id: id).paid - unless tickets. blank? - tickets.inject(Money.new(0, tickets.first.price_currency)){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) } - else + if tickets.blank? Money.new(0, Ticket.find(id).price_currency) + else + tickets.inject(Money.new(0, tickets.first.price_currency)){ |sum, ticket| sum + (ticket.amount_paid * ticket.quantity) } end end