mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
get_progress: cleanup case statement
This commit is contained in:
parent
eea7d94223
commit
e9ba87a49c
1 changed files with 6 additions and 5 deletions
|
|
@ -28,16 +28,17 @@ class Target < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +String+ -> progress in percent
|
||||
def get_progress
|
||||
case unit
|
||||
numerator = case unit
|
||||
when Target.units[:submissions]
|
||||
numerator = conference.events.where('created_at < ?', due_date).count
|
||||
conference.events.where('created_at < ?', due_date).count
|
||||
when Target.units[:registrations]
|
||||
numerator = conference.registrations.where('created_at < ?', due_date).count
|
||||
conference.registrations.where('created_at < ?', due_date).count
|
||||
when Target.units[:program_minutes]
|
||||
numerator = conference.current_program_minutes
|
||||
conference.current_program_minutes
|
||||
else
|
||||
numerator = 0
|
||||
0
|
||||
end
|
||||
|
||||
(100 * numerator / target_count).to_s
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue