Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Commit

Permalink
reimplement mood adjustment view helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Hopkins committed Oct 16, 2013
1 parent ffd006a commit 8a80ebb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions app/helpers/dashboard_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
module DashboardHelper
def mood_adjustment(mood)
case mood.sub_type
when 0
mood.title = "No Data"
return 8
when 1
mood.title = "Amazing!"
return 8
when 2
mood.title = "Pumped UP"
return 7
when 3
mood.title = "Energized"
return 6
when 4
mood.title = "Meh"
return 4
when 5
mood.title = "Dragging"
return 3
when 6
mood.title = "Exhausted"
return 2
when 7
mood.title = "Totally Done"
return 1
when 8
mood.title = "Good"
return 5
end
end
end
2 changes: 1 addition & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
{
fillColor : "<%= if @user.current_mood.title == 'No Data' then '#f7464a' else 'rgba(224,228,204,0.5)' end %>",
strokeColor : "rgba(224,228,204,1)",
data : ["<%= @user.current_mood.sub_type %>"]
data : ["<%= mood_adjustment(@user.current_mood) %>"]
}
]
};
Expand Down

0 comments on commit 8a80ebb

Please sign in to comment.