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" }
|
set :database, { adapter: 'sqlite3', database: "mood-#{ENV['RACK_ENV']}.sqlite3" }
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
@last_mood = Mood.last
|
@mode = Mood.last&.mode || 'croisiere'
|
||||||
@mood_log = Mood.log
|
@mood_log = Mood.log || []
|
||||||
erb :index
|
erb :index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
showCurrent() {
|
showCurrent() {
|
||||||
const image = this.imageTarget
|
const image = this.imageTarget
|
||||||
image.src = "<%= @last_mood.mode %>.png"
|
image.src = "<%= @mode %>.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -107,7 +107,7 @@ tbody tr td {
|
||||||
</head>
|
</head>
|
||||||
<main data-controller="mood">
|
<main data-controller="mood">
|
||||||
<div class="mode">
|
<div class="mode">
|
||||||
<img data-mood-target="image" src="<%= @last_mood.mode %>.png">
|
<img data-mood-target="image" src="<%= @mode %>.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="tracker">
|
<div class="tracker">
|
||||||
<div class="info">
|
<div class="info">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue