# frozen_string_literal: true module EuchreCamp module Actions module Admin module Tournaments module Rounds class Show < EuchreCamp::Action include Deps[ events_repo: 'repositories.events', rounds_repo: 'repositories.tournament_rounds', matchups_repo: 'repositories.bracket_matchups', teams_repo: 'repositories.teams' ] def handle(request, response) tournament_id = request.params[:id] round_id = request.params[:round_id] tournament = events_repo.by_id(tournament_id) round = rounds_repo.by_event(tournament_id).find { |r| r[:id] == round_id.to_i } matchups = matchups_repo.by_round(round_id) teams = teams_repo.by_event(tournament_id) response.render(view, tournament: tournament, round: round, matchups: matchups, teams: teams ) end end end end end end end