mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-01-19 17:34:43 +00:00
tweak return details
This commit is contained in:
parent
c10cd44615
commit
98affddbff
|
|
@ -28,8 +28,9 @@ export class GamesController {
|
|||
// /games/gametype/:gametype
|
||||
@Get('gametype/:gametype')
|
||||
@ApiOperation({ tags: [ 'Game' ], summary: 'Return the latest games by game type' })
|
||||
findByType(@Param('gametype') gametype: string) {
|
||||
return this.gamesService.findByType(gametype);
|
||||
findByType(@Param('gametype') gametype: string, @Query() paginationQuery: PaginationQueryDto) {
|
||||
const { limit = 10, offset = 0 } = paginationQuery;
|
||||
return this.gamesService.findByType(gametype, { limit, offset });
|
||||
}
|
||||
|
||||
// /games/gametype/CTFGame/summary
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ export class GamesService {
|
|||
abvSummary.push(summary);
|
||||
}
|
||||
|
||||
// Only return games when the score is 100 or greater
|
||||
return abvSummary.filter((g) => g.totalScore >= 100);
|
||||
// Only return games when the score is greater than 1
|
||||
return abvSummary.filter((g) => g.totalScore > 1);
|
||||
}
|
||||
|
||||
async findAllWithSummary(paginationQuery: PaginationQueryDto) {
|
||||
|
|
@ -60,11 +60,14 @@ export class GamesService {
|
|||
return withSummary;
|
||||
}
|
||||
|
||||
async findByType(gametype: string) {
|
||||
async findByType(gametype: string, paginationQuery: PaginationQueryDto) {
|
||||
const { limit, offset } = paginationQuery;
|
||||
const returnMaxLimit = Math.min(100, Math.max(0, limit));
|
||||
|
||||
const games = await this.gamesRepository.find({
|
||||
where: { gametype: gametype },
|
||||
skip: 0,
|
||||
take: 10,
|
||||
skip: offset,
|
||||
take: returnMaxLimit,
|
||||
order: {
|
||||
gameId: 'DESC'
|
||||
}
|
||||
|
|
@ -79,8 +82,8 @@ export class GamesService {
|
|||
abvSummary.push(summary);
|
||||
}
|
||||
|
||||
// Only return games when the score is 100 or greater
|
||||
return abvSummary.filter((g) => g.totalScore >= 100);
|
||||
// Only return games when the score is greater than 1
|
||||
return abvSummary.filter((g) => g.totalScore > 1);
|
||||
}
|
||||
|
||||
async findByTypeWithSummary(gametype: string, paginationQuery: PaginationQueryDto) {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export class PlayerService {
|
|||
Number(player.totalGamesDmgame) +
|
||||
Number(player.totalGamesSctfgame) +
|
||||
Number(player.totalGamesLakrabbitgame),
|
||||
gameDetails: gameDetails.sort((a, b) => b.id - a.id),
|
||||
gameDetails: gameDetails.sort((a, b) => b.id - a.id).filter((g) => g.stats.scoreTG > 0),
|
||||
statTotals: playerStatTotals
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ services:
|
|||
replicas: 1
|
||||
|
||||
api:
|
||||
image: "amineo/t2-stats-api:v0.0.10"
|
||||
image: "amineo/t2-stats-api:v0.0.12"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./build/api/Dockerfile
|
||||
|
|
|
|||
Loading…
Reference in a new issue