mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
- 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.
33 lines
807 B
Ruby
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
|