At least one fewer test should fail now
continuous-integration/drone/pr Build is failing Details

ref #190
This commit is contained in:
Nicolai Ort 2021-04-07 16:17:37 +02:00
parent 4a73eab134
commit 87f444c30d
3 changed files with 16 additions and 6 deletions

View File

@ -53,7 +53,7 @@ export class StatsController {
@ResponseSchema(ResponseStatsRunner, { isArray: true })
@OpenAPI({ description: "Returns the top ten runners by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
async getTopRunnersByDonations() {
let runners = await getConnection().getRepository(Runner).find({ relations: ['scans', 'group', 'distanceDonations', 'scans.track'] });
let runners = await getConnection().getRepository(Runner).find({ relations: ['group', 'distanceDonations', 'distanceDonations.runner', 'distanceDonations.runner.scans', 'distanceDonations.runner.scans.track'] });
if (!runners || runners.length == 0) {
return [];
}

View File

@ -76,10 +76,22 @@ export class ResponseStatsRunner implements IResponse {
public constructor(runner: Runner, laptime?: number) {
this.id = runner.id;
this.firstname = runner.firstname;
this.middlename = runner.middlename;
if (runner.firstname) {
this.middlename = runner.middlename;
}
this.lastname = runner.lastname;
this.distance = runner.distance;
this.donationAmount = runner.distanceDonationAmount;
try {
this.distance = runner.distance;
}
catch {
this.distance = -1;
}
try {
this.donationAmount = runner.distanceDonationAmount;
}
catch {
this.donationAmount = -1;
}
if (laptime) {
this.minLaptime = laptime;
}

View File

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