diff --git a/app/models/mood.rb b/app/models/mood.rb index 4a851cc..5a1ab13 100644 --- a/app/models/mood.rb +++ b/app/models/mood.rb @@ -16,14 +16,14 @@ class Mood < ApplicationRecord mood_range = Mood.order(:recorded_at).where(recorded_at: (first_monday..to)) mood_range.each do |mood| while current_date < mood.recorded_at.to_date do - log_mood << [ current_date.to_s, current_mode ] + log_mood << [ current_date, current_mode ] current_date += 1 end current_mode = mood.mode end while current_date <= to.to_date do - log_mood << [ current_date.to_s, current_mode ] + log_mood << [ current_date, current_mode ] current_date += 1 end log_mood.each_slice(7).to_a diff --git a/app/views/moods/index.html.erb b/app/views/moods/index.html.erb index b8a9f15..45bbeba 100644 --- a/app/views/moods/index.html.erb +++ b/app/views/moods/index.html.erb @@ -42,15 +42,14 @@ <% @mood_log.each do |week| %>
- <% day = Date.parse(week.first[0]) %> + <% day = week.first[0] %> <% if day.day < 8 && day.monday? %> <%= l(day, format: "%b") %> <% end %>
<% week.each do |d| %> - <% day = Date.parse(d[0]) %> <% if d[1] %> -
" data-mode="<%= d[1] %>" data-day="<%= d[0] %>" data-action="click->mood#updateDayInfo mouseover->mood#updateDayInfo mouseleave->mood#updateDayInfo" title="<%= d[0] %> : <%= d[1] %>" class="day <%= d[1] %>">
+
" data-mode="<%= d[1] %>" data-day="<%= l d[0] %>" data-action="click->mood#updateDayInfo mouseover->mood#updateDayInfo mouseleave->mood#updateDayInfo" title="<%= d[0] %> : <%= d[1] %>" class="day <%= d[1] %>">
<% else %>
<% end %>