Competition module

Hi there, I am building a program for a soccer competition. I am trying to build in that a team can only play one game a day. I am not sure how set this, is a microflow the best way or are there other options? Can you please give me some advise on how to make this possible? Thx. Masja
1 answers

A Microflow would be the best option. You could model this as follows:

  • A Team entity, detailing your teams
  • A Game entity, detailing the games that have been played
  • The Game entity has two associations to Team: Game_Team_Home and Game_Team_Away (to indicate the home team and away team)
  • On the form where you edit a Game you add a microflow button instead of the standard save button
  • In the microflow you check if the current game you are editing is the only game both team are playing today. You retrieve all Games from the database that are:
    • not the game you are currently editing,
    • on the same date as the current game
    • either have the home team as one of the two involved teams
    • or have the away team as one of the two involved teams
  • If you find such a game, you show a message to the user that this game cannot be saved, because one of the team has already played a game that day
  • If you find no such game, you commit the game