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 # ====Returns
# * +String+ -> progress in percent # * +String+ -> progress in percent
def get_progress def get_progress
numerator = case unit numerator =
when Target.units[:submissions] case unit
conference.events.where('created_at < ?', due_date).count when Target.units[:submissions]
when Target.units[:registrations] conference.events.where('created_at < ?', due_date).count
conference.registrations.where('created_at < ?', due_date).count when Target.units[:registrations]
when Target.units[:program_minutes] conference.registrations.where('created_at < ?', due_date).count
conference.current_program_minutes when Target.units[:program_minutes]
else conference.current_program_minutes
0 else
end 0
end
(100 * numerator / target_count).to_s (100 * numerator / target_count).to_s
end end