get_progress: align case and when as rubocop
This commit is contained in:
parent
e9ba87a49c
commit
28669ac635
1 changed files with 11 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue