show guess mood if query param

This commit is contained in:
Christophe Robillard 2026-02-07 13:05:24 +01:00
parent a75b9242f1
commit bb7328f151
3 changed files with 13 additions and 1 deletions

View file

@ -84,6 +84,11 @@ main {
background-color: red; background-color: red;
} }
.unknown {
border: 2px double grey;
background-color: white;
}
.en-charge { .en-charge {
background-color: orange; background-color: orange;
} }

View file

@ -1,2 +1,9 @@
module MoodsHelper module MoodsHelper
def mode_for(mood)
if params[:guess] == "active"
mood[:mode] || mood[:guess] || "unknown"
else
mood[:mode] || "unknown"
end
end
end end

View file

@ -46,7 +46,7 @@
<% month[:weeks].each do |week| %> <% month[:weeks].each do |week| %>
<div class="is-flex is-flex-direction-column is-flex-wrap-wrap mb-3"> <div class="is-flex is-flex-direction-column is-flex-wrap-wrap mb-3">
<% week.each do |mood| %> <% week.each do |mood| %>
<% mode = mood[:mode] || mood[:guess] || "unknown" %> <% mode = mode_for(mood) %>
<div data-image="<%= asset_path(mode + ".jpg") %>" data-mode="<%= mode %>" data-day="<%= l mood[:recorded_at] %>" data-action="click->mood#updateDayInfo mouseover->mood#updateDayInfo mouseleave->mood#removeFeedback" title="<%= mood[:recorded_at] %> : <%= mode %>" class="day <%= mode %>"></div> <div data-image="<%= asset_path(mode + ".jpg") %>" data-mode="<%= mode %>" data-day="<%= l mood[:recorded_at] %>" data-action="click->mood#updateDayInfo mouseover->mood#updateDayInfo mouseleave->mood#removeFeedback" title="<%= mood[:recorded_at] %> : <%= mode %>" class="day <%= mode %>"></div>
<% end %> <% end %>
</div> </div>