@@ -1,5 +1,6 @@
|
||||
import { IsInt, IsNotEmpty, IsPositive } from "class-validator";
|
||||
import { ChildEntity, Column, ManyToOne } from "typeorm";
|
||||
import { ResponseDistanceDonation } from '../responses/ResponseDistanceDonation';
|
||||
import { Donation } from "./Donation";
|
||||
import { Runner } from "./Runner";
|
||||
|
||||
@@ -31,7 +32,7 @@ export class DistanceDonation extends Donation {
|
||||
* Get's calculated from the runner's distance ran and the amount donated per kilometer.
|
||||
*/
|
||||
public get amount(): number {
|
||||
let calculatedAmount = -1;
|
||||
let calculatedAmount = 0;
|
||||
try {
|
||||
calculatedAmount = this.amountPerDistance * (this.runner.distance / 1000);
|
||||
} catch (error) {
|
||||
@@ -43,7 +44,7 @@ export class DistanceDonation extends Donation {
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
public toResponse(): DistanceDonation {
|
||||
return null;
|
||||
public toResponse(): ResponseDistanceDonation {
|
||||
return new ResponseDistanceDonation(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user