Added missing getter
This commit is contained in:
parent
abf7aaeda3
commit
84dd1fe4a5
@ -1,5 +1,5 @@
|
|||||||
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
|
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
|
||||||
import { IsNotEmpty,} from "class-validator";
|
import { IsInt, IsNotEmpty,} from "class-validator";
|
||||||
import { Participant } from "./Participant";
|
import { Participant } from "./Participant";
|
||||||
import { RunnerGroup } from "./RunnerGroup";
|
import { RunnerGroup } from "./RunnerGroup";
|
||||||
import { DistanceDonation } from "./DistanceDonation";
|
import { DistanceDonation } from "./DistanceDonation";
|
||||||
@ -36,4 +36,10 @@ export class Runner extends Participant {
|
|||||||
*/
|
*/
|
||||||
@OneToMany(() => Scan, scan => scan.runner)
|
@OneToMany(() => Scan, scan => scan.runner)
|
||||||
scans: Scan[];
|
scans: Scan[];
|
||||||
|
|
||||||
|
@IsInt()
|
||||||
|
public get distance() : number {
|
||||||
|
return this.scans.filter(scan => scan.valid === true).reduce((sum, current) => sum + current.distance, 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user