Release 0.10.2 #192

Merged
niggl merged 41 commits from dev into main 2021-04-07 17:27:49 +00:00
3 changed files with 16 additions and 6 deletions
Showing only changes of commit 87f444c30d - Show all commits

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");
});