From 9053251706dfa08b6d50c808d12bd6a184ae6414 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Sun, 28 Apr 2019 17:21:36 +0200 Subject: [PATCH] Document group_stage generation parameter preparation --- app/controllers/tournaments_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index ffaece6..6e6c65e 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -36,11 +36,15 @@ class TournamentsController < ApplicationController # create tournament tournament = current_user.tournaments.new params if group_stage + # if parameter group_stage = true groups = {} + # each team gets put into a hash of groups depending on the value assigned in team[:group] + # groups is a key value hash; key being the group, value being the array of teams within that group teams.each do |team| team_id = team[:id] team_name = team[:name] group = team[:group] + # convert teams parameter into Team objects if team_id team = Team.find team_id put_team_into_groups_hash!(groups, team, group)