summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--web/web.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/web/web.rb b/web/web.rb index 8685de3..4d424ec 100644 --- a/web/web.rb +++ b/web/web.rb
@@ -10,7 +10,7 @@ use Rack::Cache
10config = YAML.load(open("config.yml")) 10config = YAML.load(open("config.yml"))
11db = Sequel.connect("sqlite://#{config["database"]}") 11db = Sequel.connect("sqlite://#{config["database"]}")
12 12
13Sequel::Model.plugin :timestamps 13Sequel::Model.plugin :timestamps, update_on_create: true
14 14
15class LingoScore < Sequel::Model 15class LingoScore < Sequel::Model
16end 16end
@@ -26,7 +26,7 @@ post '/update' do
26 403 26 403
27 else 27 else
28 if LingoScore.where(user_id: params[:user_id]).count == 0 28 if LingoScore.where(user_id: params[:user_id]).count == 0
29 score = LingoScore.new(score: 0) 29 score = LingoScore.new(score: 0, user_id: params[:user_id])
30 else 30 else
31 score = LingoScore.first(user_id: params[:user_id]) 31 score = LingoScore.first(user_id: params[:user_id])
32 end 32 end