From 862cb4e3f9b9864bc1b5a20cd7ebd7c4d6cccb77 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 29 Oct 2023 14:46:27 -0400 Subject: added timer --- app/controllers/wittle/puzzles_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers') 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 @puzzle.save! end + @time = (params.include? :time) ? params[:time] : nil + session[:played_puzzles] ||= [] session[:played_puzzles] << @puzzle.id end @@ -33,7 +35,7 @@ module Wittle raise ActiveRecord::RecordNotFound unless @puzzle.latest? - @puzzle.scores.create!(name: params[:name], ip: request.ip) + @puzzle.scores.create!(name: params[:name], ip: request.ip, seconds_taken: (params.include? :time) ? params[:time] : nil) redirect_to @puzzle end -- cgit 1.4.1