diff options
-rw-r--r-- | web/web.rb | 4 |
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 | |||
10 | config = YAML.load(open("config.yml")) | 10 | config = YAML.load(open("config.yml")) |
11 | db = Sequel.connect("sqlite://#{config["database"]}") | 11 | db = Sequel.connect("sqlite://#{config["database"]}") |
12 | 12 | ||
13 | Sequel::Model.plugin :timestamps | 13 | Sequel::Model.plugin :timestamps, update_on_create: true |
14 | 14 | ||
15 | class LingoScore < Sequel::Model | 15 | class LingoScore < Sequel::Model |
16 | end | 16 | end |
@@ -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 |