import type { ParticipationInfo } from './types'; /** * The usual participation as the settings tell it: the measured median, or the * reference (twice C). When the scale brings it back within its bounds, the * bounded value is what the formula uses, and is said apart. The number of * voters is rounded for reading; its share is that of the value itself (a * median of 2,5 voters out of 4 is 62,5 %, not 3 out of 4). */ export function usualShown(p: ParticipationInfo, electorate: number, floor: number): { voters: number; ratio: number } { if (!p.bounded || electorate <= 0) return { voters: p.voters, ratio: p.ratio }; const raw = p.source === 'median' && p.median !== null ? p.median : 2 * floor; return { voters: Math.round(raw), ratio: raw / electorate }; }