diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/wittle/puzzles_controller.rb | 4 |
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 |