Skip to content

Commit

Permalink
Make sure the number of served benificiaries are shown
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmenno committed Sep 2, 2024
1 parent 38a796b commit cd0e3d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions PWA/public/Services/BenificiaryInfoService.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ export class BenificiaryInfoService {
}
async benificiaryInfoTextFromDistribution(distribution) {
const benificiaries = await this.database.benificiariesForDistribution(distribution);
const numberOfServedBenificiaries = 42; //TODO: implement proper calculation
const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length;
if (benificiaries.length > 0) {
//Beneficiaries served: {{ number_recipients }} / {{ number_beneficiaries }}
return "Beneficiaries served: " + numberOfServedBenificiaries;
return "Beneficiaries served: " + numberOfServedBenificiaries + " / " + benificiaries.length;
}
else {
return "No beneficiary data found";
Expand Down
5 changes: 2 additions & 3 deletions PWA/src/Services/BenificiaryInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ export class BenificiaryInfoService {

async benificiaryInfoTextFromDistribution(distribution: Distribution): Promise<string> {
const benificiaries: DistributionBeneficiary[] = await this.database.benificiariesForDistribution(distribution)
const numberOfServedBenificiaries = 42 //TODO: implement proper calculation
const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length
if(benificiaries.length > 0) {
//Beneficiaries served: {{ number_recipients }} / {{ number_beneficiaries }}
return "Beneficiaries served: " + numberOfServedBenificiaries
return "Beneficiaries served: " + numberOfServedBenificiaries +" / " + benificiaries.length
} else {
return "No beneficiary data found"
}
Expand Down

0 comments on commit cd0e3d4

Please sign in to comment.