diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 3bdb9a4..d343635 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,11 +2,9 @@ class HomeController < ApplicationController allow_unauthenticated_access def index - user = User.find_by(username: request.subdomain) - if user&.public? - @mode = user.current_mood - @history = user.history - render template: "moods/index" + @user = User.find_by(username: request.subdomain) + if @user&.public? + render "moods/index" else redirect_to dashboard_path end diff --git a/app/controllers/moods_controller.rb b/app/controllers/moods_controller.rb index 8773247..abadc91 100644 --- a/app/controllers/moods_controller.rb +++ b/app/controllers/moods_controller.rb @@ -1,6 +1,5 @@ class MoodsController < ApplicationController def index - @mode = Current.user.current_mood - @history = Current.user.history + @user = Current.user end end diff --git a/app/helpers/moods_helper.rb b/app/helpers/moods_helper.rb index f676d1d..0c04021 100644 --- a/app/helpers/moods_helper.rb +++ b/app/helpers/moods_helper.rb @@ -1,6 +1,6 @@ module MoodsHelper - def mode_for(mood) - if params[:guess] == "active" + def mode_for(mood, user) + if user.guess? mood[:mode] || mood[:guess] || "unknown" else mood[:mode] || "unknown" diff --git a/app/views/moods/index.html.erb b/app/views/moods/index.html.erb index db55032..897ba16 100644 --- a/app/views/moods/index.html.erb +++ b/app/views/moods/index.html.erb @@ -2,7 +2,7 @@