mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
Better handling of case statement for previous commit
This commit is contained in:
parent
8289741421
commit
12e9a05334
1 changed files with 7 additions and 6 deletions
|
|
@ -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>"
|
||||
%>
|
||||
|
|
|
|||
Loading…
Reference in a new issue