From d61b45e8438cac6ffd2b8a49507db4467d29b11d Mon Sep 17 00:00:00 2001 From: Mahdi Date: Mon, 28 Oct 2024 18:57:14 +0330 Subject: [PATCH] Fix no other pairs + non-100 percent percentage bug --- src/flow/flow.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/flow/flow.service.ts b/src/flow/flow.service.ts index d1034df..5886a5f 100644 --- a/src/flow/flow.service.ts +++ b/src/flow/flow.service.ts @@ -667,7 +667,7 @@ export class FlowService { // console.log('total:', total); if (total === 0) { - return allVotes.length / combinations(allProjects.length, 2); + return 0; } return effectiveVotes.length / total; @@ -918,6 +918,11 @@ export class FlowService { ), ); + if (pairs.length === 0 && collection) { + // Finishing the collection automatically + await this.finishCollection(userId, collection.id); + } + return { pairs, totalPairs: combinations.length,