From 03f44c53e35fc1643a39a1e31141ead8c275a3a0 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 29 Oct 2023 21:04:43 -0400 Subject: disable sending a time if you refresh the page --- app/controllers/wittle/puzzles_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/controllers') 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 def show @puzzle = Puzzle.find(params[:id]) @playable = @puzzle.latest? && !((session[:played_puzzles] || []).include? @puzzle.id) + @already_started = ((session[:started_puzzles] || []).include? @puzzle.id) + end + + def start + @puzzle = Puzzle.find(params[:id]) + + session[:started_puzzles] ||= [] + session[:started_puzzles] << @puzzle.id end def solve -- cgit 1.4.1