| ... | ... | @@ -151,32 +151,14 @@ Contains two functions and four helper functions |
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### getScores(gameId: GameEntity)
|
|
|
|
### mockdata(gameId: GameEntity)
|
|
|
|
|
|
|
|
- Returns all factions' scores and their colour
|
|
|
|
- Generates some mockdata for the game
|
|
|
|
|
|
|
|
### scoreTick(gameId)
|
|
|
|
- The code has good documentation already
|
|
|
|
|
|
|
|
- Triggered by backend's internal clock
|
|
|
|
- Can be used to test replay functionality, is also part of the [Postman](https://gitlab.labranet.jamk.fi/wimma-lab-2019/overflow/core/wikis/testing/postman) collection.
|
|
|
|
|
|
|
|
- Logic explained in greater detail in [`tick`](./tick)
|
|
|
|
- Uses the `createEvent` helper function to generate some objective point events for the mockdata
|
|
|
|
|
|
|
|
- Calculates points for factions based on their controlled objective points
|
|
|
|
|
|
|
|
- Uses a helper function `pushScore` to add new scores to the repository
|
|
|
|
|
|
|
|
- At the end of the tick, sends a socket update to trigger score fetch in frontend
|
|
|
|
|
|
|
|
#### pushscore(data: [`ScoreDTO`](./dtos#scoredto))
|
|
|
|
|
|
|
|
- throws an exception if faction was not found
|
|
|
|
|
|
|
|
- takes the latest score and sums the new score to the latest score
|
|
|
|
|
|
|
|
## score.entity.ts
|
|
|
|
|
|
|
|
Reflects the datababse table for score.
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
``` |
|
|
|
- Has dumb logic, which results in scenarios where a team may be capturing their own objectives they already control |