HELP! Tournament Automatic Match Schedule Creation (Round Robin Group Stage)

Hi Bubblers,

I have created an app for Soccer Tournament management. I basically have two apps one for the users and one for the tournament admins. On the user side you can join teams, join tournaments, confirm match attendance, see other players stats and profiles, etc. On the admin side you can create tournaments and manage every aspect of the tournament (create gameweeks, games, report goals and stats).

Anyways, the app is all done and up and running. However, we met with our first client (who is a Soccer field owner who runs many tournaments) and he said that a feature that he would love is that when you create a tournament you should be able to auto generate all the match schedules instantly based on number of teams, number of groups, and type of tournament. I have been working on this new feature for the past few days using backend workflows but I just can’t seem to make it work. (You have to make sure that all teams face each other once or twice if they choose to do it home and away rounds). This problem is driving me crazy so I was hoping that someone here could help me or if someone has done something similar.

For some more context the way the data is structured:

  • Tournament (has a list of teams, list of groups if the tournament has a groupstage format with a list of teams, a list of matchweeks)
  • Matchweek (has a list of matches)
  • Matches(has teamA,teamB,plus all other details)
  • Team (has a list of users)

Any help is appreciated!

An example to visualize what I need:

Let’s say we create a tournament with:

  • 8 teams
  • 2 groups of 4 teams
  • Group A: teamA, teamB, teamC, teamD
  • Group B:teamE, teamF, teamG, teamH
  • Only one neutral round (no home and away games)

That means that we will have 3 matchweeks with 4 games in each macthweek:

Matchweek 1:
GROUP A:
A vs B
C vs D
GROUP B:
E vs F
G vs H

Matchweek 2:
A vs C
D vs B

E vs G
H vs F

Matchweek 3:
A vs D
B vs C

E vs H
F vs G

So when you click the button it should automatically create all these 3 matchweeks each with these 4 games. Making sure that they all face each other within the group

Interesting… definitely will need either a recursive workflow or Schedule API Workflow on a List… let me think