-
Notifications
You must be signed in to change notification settings - Fork 0
Class Model and Data
*Please note that Getters and Setters for private instances are omitted in the UML diagram.
When the app is started, utils/initializeLocalData.dart updates the variables with their respective values from the database so that all models are stored locally and don't have to be fetched every time from the database. Depending on their lifetime and frequency of change, the Controllers TempController and PersistentController store these objects so that every Flutter widget can access them throughout the app. The repository variable that is hold by both controllers is utilized to write changes/updates on the local objects to firestore.
After the startup and during the entire lifecycle of the app teams and players are stored within the cachedTeamsList variable in PersistentController. Inside all the teams belonging to the loggedInClub are stored. Inside each team object all the respective players can be found. When a player, team or their properties are modified, the respective object inside cachedTeamsList is updated. The selectedTeam variable is a temporary variable that gets updated every time a new team is selected inside the setting screen.\
Additionally, TempController holds several players lists and instances that are utilized throughout a game, such as playersToChange, i.e. the list of players that is suggested when a substitution is performed during a game. All these instances operate based on reference, which means that all player instances only exist once and their copies are just pointers to the original instances. This is crucial to keep in mind e.g. for the Ef-Score calculation to work properly.
initially implemented in the scope of Issue #47
- This class holds the Ef-Score of a Player instance in it's
score-property - Additionally, it stores the amount of actions of each type in a map called
actionStats, and, to enable faster updates, the overall sum of actions in a separate variablenumOfActions - It also implements the calcluation of the Ef-Score based on the parameters explained above in the function
calculate
- This class is used to track the realtime Ef-Score of a player during a game.
- It class includes the function
addAction, that needs to be called every time a new action is added to aPlayerobject. It automatically updates thescoreproperty to the current Ef-Score based on all actions the player has performed during the current game - Analogously, the
removeActionfunction needs to be called every time an action is removed (in case of accidentally wrong user input) and automatically updates the Ef-Score accordingly
- For this purpose, the setter method
updatePlayerEfScore()incontrollers/tempController.dartshould be used - it automatically updates the correct instance of a player based on its ID and updates the Ef-Score displaying widgets
This sidebar is customized. You can add new pages here by clicking 'Edit sidebar' above. To see all pages that exist in the Wiki click here
Ef Score
Firebase
UI
Figma Screens
Flutter
- Dashboard
- Start Game Screen
- Authentication Screen
- App Settings
- Class Model and Data
- Feed
- First Steps
- Helper Screen
- Settings Screen
- State Management
- Testing
- String Management
- Helpers