Compare commits

...

2 Commits

Author SHA1 Message Date
23bd432c5f Resolved missing parentgroup relation
Some checks failed
continuous-integration/drone/pr Build is failing
ref #190
2021-04-07 16:23:13 +02:00
71b33ab05b Removed console logs for now working tests
ref #190
2021-04-07 16:21:01 +02:00
2 changed files with 2 additions and 6 deletions

View File

@ -106,7 +106,7 @@ export class StatsController {
@ResponseSchema(ResponseStatsTeam, { isArray: true })
@OpenAPI({ description: "Returns the top ten teams by distance.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
async getTopTeamsByDistance() {
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track'] });
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ['parentGroup', 'runners', 'runners.scans', 'runners.scans.track'] });
if (!teams || teams.length == 0) {
return [];
}
@ -123,7 +123,7 @@ export class StatsController {
@ResponseSchema(ResponseStatsTeam, { isArray: true })
@OpenAPI({ description: "Returns the top ten teams by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
async getTopTeamsByDonations() {
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track'] });
let teams = await getConnection().getRepository(RunnerTeam).find({ relations: ['parentGroup', 'runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track'] });
if (!teams || teams.length == 0) {
return [];
}

View File

@ -52,15 +52,11 @@ describe('GET /api/stats/runners/* should return 200', () => {
});
it('get by donations w/ auth should return 200', async () => {
const res = await axios.get(base + '/api/stats/runners/donations', axios_config_stats);
console.log("################# Runners by donations #################");
console.log(res.data);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
});
it('get by laptime w/ auth should return 200', async () => {
const res = await axios.get(base + '/api/stats/runners/laptime', axios_config_stats);
console.log("################# Runners by laptime #################");
console.log(res.data);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
});