Better handling of case statement for previous commit

This commit is contained in:
Tyler Renelle 2012-02-01 10:52:49 -05:00
parent 8289741421
commit 12e9a05334

View file

@ -1,12 +1,13 @@
<div id="<%= habit.id %>">
<%
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 = "<span class='#{score}'>#{habit.name}</span>"
%>