From 12e9a05334f81f9322111e486b0b40ac2e0c96e6 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 1 Feb 2012 10:52:49 -0500 Subject: [PATCH] Better handling of case statement for previous commit --- app/views/habits/_habit.html.erb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/habits/_habit.html.erb b/app/views/habits/_habit.html.erb index f901db0e81..fd82f60dc7 100644 --- a/app/views/habits/_habit.html.erb +++ b/app/views/habits/_habit.html.erb @@ -1,12 +1,13 @@
<% - case habit.score - when -100..-5 then score = 'bad' - when -5..0 then score = 'iffy' - when 0..5 then score = 'ok' - when 5..15 then score = 'good' - when 15..100 then score = 'done' + s = habit.score + case + when s<-5 then score = 'bad' + when s>=-5 && s<0 then score = 'iffy' + when s>=0 && s<5 then score = 'ok' + when s>=5 && s<15 then score = 'good' + when s>=15 then score = 'done' end name = "#{habit.name}" %>