Added payedDonationAmount to donor and responsedonor
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #193
This commit is contained in:
parent
8fe3243693
commit
8ae4b85827
|
@ -33,6 +33,15 @@ export class Donor extends Participant {
|
|||
return this.donations.reduce((sum, current) => sum + current.amount, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total payed donations of a donor based on his linked donations.
|
||||
*/
|
||||
@IsInt()
|
||||
public get payedDonationAmount(): number {
|
||||
if (!this.donations) { return 0; }
|
||||
return this.donations.reduce((sum, current) => sum + current.payedAmount, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,12 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
|
|||
@IsInt()
|
||||
donationAmount: number;
|
||||
|
||||
/**
|
||||
* Returns the total payed donations of a donor based on his linked donations.
|
||||
*/
|
||||
@IsInt()
|
||||
payedDonationAmount: number;
|
||||
|
||||
/**
|
||||
* Creates a ResponseRunner object from a runner.
|
||||
* @param runner The user the response shall be build for.
|
||||
|
|
Loading…
Reference in New Issue