Skip to content

Commit

Permalink
Fix no other pairs + non-100 percent percentage bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahdigh committed Oct 28, 2024
1 parent 90848f8 commit d61b45e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/flow/flow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d61b45e

Please sign in to comment.