From fb689298c7c30983a1b2869aa2a5bc0fda3b64e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Wed, 5 Apr 2023 12:41:58 +0200 Subject: [PATCH] Fix weekly randomizer when standup channel have less than 4 people --- server/source/jobs/weekly-randomizer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/source/jobs/weekly-randomizer.ts b/server/source/jobs/weekly-randomizer.ts index 842f2d670..1723e7f7c 100644 --- a/server/source/jobs/weekly-randomizer.ts +++ b/server/source/jobs/weekly-randomizer.ts @@ -42,6 +42,10 @@ const standupMembers = await Promise.all( ) ) +while (standupMembers.length > 0 && standupMembers.length < 4) { + standupMembers.push(...standupMembers) +} + const shuffleMembers = shuffleArray(standupMembers) await mongo.setWeeklyTeamOrder(shuffleMembers.map(({ id }) => id))