From ee3def430ecd5cd8a0d31d0ce6db3f2850d7cc85 Mon Sep 17 00:00:00 2001 From: Sameer Deshmukh Date: Thu, 26 Feb 2015 12:58:28 +0530 Subject: [PATCH] replace if-else with case-when replaced if-else with case-when slight update --- app/helpers/application_helper.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 50b11829..ab888440 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,13 +1,13 @@ module ApplicationHelper def target_progress_color(progress) progress = progress.to_i - if progress > 90 - result = 'green' - elsif progress < 90 && progress > 80 - result = 'orange' - else - result = 'red' + result = + case + when progress >= 90 then 'green' + when progress < 90 && progress >= 80 then 'orange' + else 'red' end + result end