Add hidden setting to puzzles
All checks were successful
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 36s

#19
This commit is contained in:
sto
2025-12-04 11:35:41 +01:00
parent a2a8a9fcef
commit 51e55f0828
11 changed files with 36 additions and 10 deletions

View File

@@ -149,7 +149,7 @@ class ContestantsController < ApplicationController
end
@contest = @contestant.contest
I18n.locale = @contest.lang
@puzzles = @contest.puzzles
@puzzles = @contest.puzzles.where(hidden: false).or(@contest.puzzles.where(hidden: nil)).order(:id)
@completion = Completion.new
@completion.completed = true
@public = true

View File

@@ -99,7 +99,7 @@ class ContestsController < ApplicationController
if params.key?(:hide_offline) && params[:hide_offline] == "true"
@contestants = @contestants.select { |contestant| !contestant.offline.present? }
end
@puzzles = @contest.puzzles.order(:id)
@puzzles = @contest.puzzles.where(hidden: false).or(@contest.puzzles.where(hidden: nil)).order(:id)
if params.key?(:hide_offline) && params.key?(:category)
@action_path = "/public/#{@contest.friendly_id}?hide_offline=#{params[:hide_offline]}&category=#{params[:category]}"
elsif params.key?(:category)

View File

@@ -59,6 +59,6 @@ class PuzzlesController < ApplicationController
end
def puzzle_params
params.expect(puzzle: [ :brand, :name, :image, :pieces ])
params.expect(puzzle: [ :brand, :name, :image, :pieces, :hidden ])
end
end