get_progress: align case and when as rubocop

This commit is contained in:
Björn Geuken 2015-04-17 14:19:32 +02:00
parent e9ba87a49c
commit 28669ac635

View file

@ -28,16 +28,17 @@ class Target < ActiveRecord::Base
# ====Returns
# * +String+ -> progress in percent
def get_progress
numerator = case unit
when Target.units[:submissions]
conference.events.where('created_at < ?', due_date).count
when Target.units[:registrations]
conference.registrations.where('created_at < ?', due_date).count
when Target.units[:program_minutes]
conference.current_program_minutes
else
0
end
numerator =
case unit
when Target.units[:submissions]
conference.events.where('created_at < ?', due_date).count
when Target.units[:registrations]
conference.registrations.where('created_at < ?', due_date).count
when Target.units[:program_minutes]
conference.current_program_minutes
else
0
end
(100 * numerator / target_count).to_s
end