stats/runners/laptime feature/190-runners_laptime #191

Merged
niggl merged 36 commits from feature/190-runners_laptime into dev 2021-04-07 17:16:35 +00:00
Showing only changes of commit 51daf969cf - Show all commits

View File

@ -1,6 +1,7 @@
import {
IsInt,
IsObject,
IsOptional,
IsString
} from "class-validator";
import { Runner } from '../entities/Runner';
@ -55,6 +56,13 @@ export class ResponseStatsRunner implements IResponse {
@IsInt()
donationAmount: number;
/**
* The runner's fastest laptime in seconds.
*/
@IsInt()
@IsOptional()
minLaptime?: number;
/**
* The runner's group.
*/
@ -65,13 +73,16 @@ export class ResponseStatsRunner implements IResponse {
* Creates a new runner stats response from a runner
* @param runner The runner whoes response shall be generated - the following relations have to be resolved: scans, group, distanceDonations, scans.track
*/
public constructor(runner: Runner) {
public constructor(runner: Runner, laptime?: number) {
this.id = runner.id;
this.firstname = runner.firstname;
this.middlename = runner.middlename;
this.lastname = runner.lastname;
this.distance = runner.distance;
this.donationAmount = runner.distanceDonationAmount;
if (laptime) {
this.minLaptime = laptime;
}
this.group = runner.group.toResponse();
}
}