Mattias Bodlund 7 months ago
parent
commit
847d33230d
6 changed files with 19 additions and 11 deletions
  1. +8
    -6
      Gemfile.lock
  2. +2
    -1
      app/assets/stylesheets/application.css
  3. +6
    -1
      app/controllers/answers_controller.rb
  4. +1
    -2
      app/controllers/questions_controller.rb
  5. +1
    -1
      config/locales/en.yml
  6. +1
    -0
      config/routes.rb

+ 8
- 6
Gemfile.lock View File

@ -84,7 +84,7 @@ GEM
benchmark (0.4.0)
bigdecimal (3.1.9)
bindex (0.8.1)
bootsnap (1.18.5)
bootsnap (1.18.6)
msgpack (~> 1.2)
builder (3.3.0)
concurrent-ruby (1.3.5)
@ -101,7 +101,8 @@ GEM
dotenv-rails (3.1.8)
dotenv (= 3.1.8)
railties (>= 6.1)
drb (2.2.1)
drb (2.2.3)
erb (5.0.1)
erubi (1.13.1)
ffi (1.17.2-aarch64-linux-gnu)
ffi (1.17.2-arm-linux-gnu)
@ -212,7 +213,7 @@ GEM
puma (6.6.0)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.14)
rack (3.1.15)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
@ -234,7 +235,7 @@ GEM
activesupport (= 8.0.2)
bundler (>= 1.15.0)
railties (= 8.0.2)
rails-dom-testing (2.2.0)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
@ -250,7 +251,8 @@ GEM
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
rdoc (6.13.1)
rdoc (6.14.0)
erb
psych (>= 4.0.0)
redis (5.4.0)
redis-client (>= 0.22.0)
@ -291,7 +293,7 @@ GEM
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.7.2)
zeitwerk (2.7.3)
PLATFORMS
aarch64-linux


+ 2
- 1
app/assets/stylesheets/application.css View File

@ -95,7 +95,7 @@
--flip-deg: 0deg;
--flip-scale: 1;
--flip-rotate: 0deg;
font: 10px/1.3 var(--ff-ikea);
}
@ -160,6 +160,7 @@ footer {
font-family: var(--ff-ikea);
writing-mode: vertical-rl;
text-orientation: mixed;
z-index: -1
}


+ 6
- 1
app/controllers/answers_controller.rb View File

@ -6,7 +6,8 @@ class AnswersController < ApplicationController
def create
not_found unless question
@answer = Answer.new(answer_params.merge(player_id: current_player.id, node_id: question.id))
@answer = Answer.find_or_initialize_by(player_id: current_player.id, node_id: question.id)
@answer.update(answer_params)
respond_to do |format|
if @answer.save
@ -19,6 +20,10 @@ class AnswersController < ApplicationController
end
def update
create
end
private


+ 1
- 2
app/controllers/questions_controller.rb View File

@ -6,8 +6,7 @@ class QuestionsController < ApplicationController
def show
not_found unless question
@answer = Answer.new(player_id: current_player.id, node_id: question.id)
@answer = Answer.find_or_initialize_by(player_id: current_player.id, node_id: question.id)
end


+ 1
- 1
config/locales/en.yml View File

@ -12,7 +12,7 @@ en:
see_results: See results
results: Results
read_more: Read more
share_on_story: Share on story
share_on_story: Share
please_type_your_name_to_continue: Please type your name to continue


+ 1
- 0
config/routes.rb View File

@ -56,6 +56,7 @@ Rails.application.routes.draw do
post 'player', to: 'players#create'
post 'q/:id/answer', to: 'answers#create'
patch 'q/:id/answer', to: 'answers#update'
get 'q/:id/answer', to: 'questions#answer'
get 'q/:id', to: 'questions#show'


Loading…
Cancel
Save