diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/wittle/puzzles_controller.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/wittle/puzzles_controller.rb b/app/controllers/wittle/puzzles_controller.rb index ed7087a..2949f94 100644 --- a/app/controllers/wittle/puzzles_controller.rb +++ b/app/controllers/wittle/puzzles_controller.rb | |||
@@ -12,6 +12,14 @@ module Wittle | |||
12 | def show | 12 | def show |
13 | @puzzle = Puzzle.find(params[:id]) | 13 | @puzzle = Puzzle.find(params[:id]) |
14 | @playable = @puzzle.latest? && !((session[:played_puzzles] || []).include? @puzzle.id) | 14 | @playable = @puzzle.latest? && !((session[:played_puzzles] || []).include? @puzzle.id) |
15 | @already_started = ((session[:started_puzzles] || []).include? @puzzle.id) | ||
16 | end | ||
17 | |||
18 | def start | ||
19 | @puzzle = Puzzle.find(params[:id]) | ||
20 | |||
21 | session[:started_puzzles] ||= [] | ||
22 | session[:started_puzzles] << @puzzle.id | ||
15 | end | 23 | end |
16 | 24 | ||
17 | def solve | 25 | def solve |