fix bug when no mood recorded
This commit is contained in:
parent
405e18d326
commit
af1bd3b374
2 changed files with 4 additions and 4 deletions
|
|
@ -10,8 +10,8 @@ class MoodApp < Sinatra::Base
|
|||
set :database, { adapter: 'sqlite3', database: "mood-#{ENV['RACK_ENV']}.sqlite3" }
|
||||
|
||||
get '/' do
|
||||
@last_mood = Mood.last
|
||||
@mood_log = Mood.log
|
||||
@mode = Mood.last&.mode || 'croisiere'
|
||||
@mood_log = Mood.log || []
|
||||
erb :index
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
showCurrent() {
|
||||
const image = this.imageTarget
|
||||
image.src = "<%= @last_mood.mode %>.png"
|
||||
image.src = "<%= @mode %>.png"
|
||||
}
|
||||
|
||||
})
|
||||
|
|
@ -107,7 +107,7 @@ tbody tr td {
|
|||
</head>
|
||||
<main data-controller="mood">
|
||||
<div class="mode">
|
||||
<img data-mood-target="image" src="<%= @last_mood.mode %>.png">
|
||||
<img data-mood-target="image" src="<%= @mode %>.png">
|
||||
</div>
|
||||
<div class="tracker">
|
||||
<div class="info">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue