Files
BreakEscape/app/controllers/break_escape/missions_controller.rb
Z. Cliffe Schreuders 26fc297ad8 Refactor tests and improve NPC handling
- Updated NPC ink loading tests to ensure proper handling of missing story files.
- Adjusted lazy loading tests for rooms to enhance clarity and maintainability.
- Enhanced unlock system tests by adding inventory checks for keys.
- Refined filtered scenario tests to ensure accurate preservation of game state.
- Improved game model tests to validate unlock functionality with various inventory scenarios.
2025-11-25 16:28:18 +00:00

33 lines
807 B
Ruby

module BreakEscape
class MissionsController < ApplicationController
def index
@missions = if defined?(Pundit)
policy_scope(Mission)
else
Mission.published
end
# Filter by collection if specified
if params[:collection].present?
@missions = @missions.by_collection(params[:collection])
end
# Eager load CyBOK data for display
@missions = @missions.includes(:break_escape_cyboks)
end
def show
@mission = Mission.find(params[:id])
authorize @mission if defined?(Pundit)
# Create or find game instance for current player
@game = Game.find_or_create_by!(
player: current_player,
mission: @mission
)
redirect_to game_path(@game)
end
end
end