Fixed bugs concerning posts

ref #13
This commit is contained in:
2020-12-05 10:59:15 +01:00
parent ef54dd5e9c
commit aca13f7308
5 changed files with 11 additions and 26 deletions

View File

@@ -28,18 +28,10 @@ export class DistanceDonation extends Donation {
* The donation's amount in cents (or whatever your currency's smallest unit is.).
* The exact implementation may differ for each type of donation.
*/
@IsInt()
public get amount() {
return this.getAmount();
}
/**
* The function that calculates the amount based on the runner object's distance.
*/
public async getAmount(): Promise<number> {
public get amount(): number {
let calculatedAmount = -1;
try {
calculatedAmount = this.amountPerDistance * await this.runner.distance();
calculatedAmount = this.amountPerDistance * this.runner.distance;
} catch (error) {
throw error;
}