about summary refs log tree commit diff stats
path: root/app/controllers
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-29 14:46:27 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-29 14:46:27 -0400
commit862cb4e3f9b9864bc1b5a20cd7ebd7c4d6cccb77 (patch)
treeb3e80c19d9c5725178279c69cb1ee660901f9a66 /app/controllers
parentd672465c2be3dc54463a92a3f1c4aa23447bc5c8 (diff)
downloadwittle-862cb4e3f9b9864bc1b5a20cd7ebd7c4d6cccb77.tar.gz
wittle-862cb4e3f9b9864bc1b5a20cd7ebd7c4d6cccb77.tar.bz2
wittle-862cb4e3f9b9864bc1b5a20cd7ebd7c4d6cccb77.zip
added timer
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/wittle/puzzles_controller.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/wittle/puzzles_controller.rb b/app/controllers/wittle/puzzles_controller.rb index 9599307..ed7087a 100644 --- a/app/controllers/wittle/puzzles_controller.rb +++ b/app/controllers/wittle/puzzles_controller.rb
@@ -24,6 +24,8 @@ module Wittle
24 @puzzle.save! 24 @puzzle.save!
25 end 25 end
26 26
27 @time = (params.include? :time) ? params[:time] : nil
28
27 session[:played_puzzles] ||= [] 29 session[:played_puzzles] ||= []
28 session[:played_puzzles] << @puzzle.id 30 session[:played_puzzles] << @puzzle.id
29 end 31 end
@@ -33,7 +35,7 @@ module Wittle
33 35
34 raise ActiveRecord::RecordNotFound unless @puzzle.latest? 36 raise ActiveRecord::RecordNotFound unless @puzzle.latest?
35 37
36 @puzzle.scores.create!(name: params[:name], ip: request.ip) 38 @puzzle.scores.create!(name: params[:name], ip: request.ip, seconds_taken: (params.include? :time) ? params[:time] : nil)
37 39
38 redirect_to @puzzle 40 redirect_to @puzzle
39 end 41 end