@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user