replace if-else with case-when
replaced if-else with case-when slight update
This commit is contained in:
parent
93a09b729e
commit
ee3def430e
1 changed files with 6 additions and 6 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
def target_progress_color(progress)
|
def target_progress_color(progress)
|
||||||
progress = progress.to_i
|
progress = progress.to_i
|
||||||
if progress > 90
|
result =
|
||||||
result = 'green'
|
case
|
||||||
elsif progress < 90 && progress > 80
|
when progress >= 90 then 'green'
|
||||||
result = 'orange'
|
when progress < 90 && progress >= 80 then 'orange'
|
||||||
else
|
else 'red'
|
||||||
result = 'red'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue