From 3cc93d750ffae97ad5a7e5c3752c3ed64a7454c4 Mon Sep 17 00:00:00 2001 From: Manyanda Chitimbo Date: Wed, 1 Jul 2020 16:26:12 +0200 Subject: [PATCH] fix: number of assigned volunteers --- platform/server/src/resolvers/custom-resolvers.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/server/src/resolvers/custom-resolvers.ts b/platform/server/src/resolvers/custom-resolvers.ts index b6b07586..3f939c55 100644 --- a/platform/server/src/resolvers/custom-resolvers.ts +++ b/platform/server/src/resolvers/custom-resolvers.ts @@ -75,6 +75,7 @@ export default { // Let's do created automatic actions based on recipients needs. // Volunteers will be picked randomly. + const pickedVolunteers = new Set(); for (const recipient of newRecipients!) { const labels = recipient.productsLabels; @@ -107,7 +108,7 @@ export default { } const volunteerId = volunteerIds[volunteerIndex].toString(); - + pickedVolunteers.add(volunteerId); const volunteerAction = { title, description: `Delivery of ${productsLabels}`, @@ -138,7 +139,7 @@ export default { date: now, owner: "ovp-admin", // TODO retrieve this info from Keycloak context numberOfCasesCreated, - numberOfVolunteersAssigned: newVolunteers!.length, + numberOfVolunteersAssigned: pickedVolunteers.size, numberOfRecipients: newRecipients!.length }, context) }