@@ -7,29 +7,30 @@ import { Runner } from '../entities/Runner';
|
||||
import { RunnerGroup } from '../entities/RunnerGroup';
|
||||
|
||||
/**
|
||||
* Defines the runner response.
|
||||
* Defines the runner stats response.
|
||||
* This differs from the normal runner responce.
|
||||
*/
|
||||
export class ResponseStatsRunner {
|
||||
/**
|
||||
* The participant's id.
|
||||
* The runner's id.
|
||||
*/
|
||||
@IsInt()
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* The participant's first name.
|
||||
* The runner's first name.
|
||||
*/
|
||||
@IsString()
|
||||
firstname: string;
|
||||
|
||||
/**
|
||||
* The participant's middle name.
|
||||
* The runner's middle name.
|
||||
*/
|
||||
@IsString()
|
||||
middlename?: string;
|
||||
|
||||
/**
|
||||
* The participant's last name.
|
||||
* The runner's last name.
|
||||
*/
|
||||
@IsString()
|
||||
lastname: string;
|
||||
@@ -57,10 +58,11 @@ export class ResponseStatsRunner {
|
||||
* @param runner The user the response shall be build for.
|
||||
*/
|
||||
public constructor(runner: Runner) {
|
||||
this.id = runner.id;
|
||||
this.firstname = runner.firstname;
|
||||
this.middlename = runner.middlename;
|
||||
this.lastname = runner.lastname;
|
||||
this.distance = runner.scans.filter(scan => { scan.valid === true }).reduce((sum, current) => sum + current.distance, 0);
|
||||
this.distance = runner.distance;
|
||||
this.donationAmount = runner.distanceDonationAmount;
|
||||
this.group = runner.group;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user