Skip to content

Commit 54606c0

Browse files
🐞 fix: Fix simple majority when only one country is present (#230)
Co-authored-by: Tade Strehk <github@strehk.eu>
1 parent 4cb831c commit 54606c0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/api/handlers/committee.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ const ref = object({
7070
return parent.customSimpleMajority;
7171
}
7272
const total = await getTotalPresentCount(parent as any);
73-
return Math.ceil(total / 2) + 1;
73+
let majority: number;
74+
if ((total / 2) % 1 == 0) {
75+
majority = total / 2 + 1;
76+
} else {
77+
majority = Math.ceil(total / 2);
78+
}
79+
return majority > total ? total : majority;
7480
}
7581
}),
7682
twoThirdsMajority: t.field({

0 commit comments

Comments
 (0)