Lot U : C35 à C37 écrits avant le code et vus rouges (poignées et vote, oui pour passer · non pour bloquer, quorum de l'auteur) ; leurs mots en fr, en, es ; needOf ; le vote simulé ne promet plus son effacement à l'ouverture de la chaîne

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-11-03 07:51:07 +01:00
co-authored by Claude Opus 5.5
parent af08fdaa8b
commit 70f7bb7247
7 changed files with 455 additions and 9 deletions
+22
View File
@@ -53,3 +53,25 @@ export function orderNote(p: Proposal): string[] {
return notes;
}
/**
* How many « oui » pass a version, how many « non » block it (Yvv, 2026-11-02: « combien il
* faut de oui pour passer et combien de non pour maintenir l'opposition »), from what the
* server says (ADR 0013): `yesNeeded`, the total of *for* that passes with the *against* cast
* now; `noNeeded`, the total of *against* that holds the *for* cast now in check — 0 when
* the quorum holds them alone. Before any vote: « 9 oui sur 12 votants ». The quorum goes
* to the tooltip (`title`), never to the title of a line.
*/
export function needOf(p: Proposal): { long: string; short: string; title: string } | null {
const e = p.evaluation;
if (!e || e.yesNeeded === undefined || e.noNeeded === undefined || e.quorum === undefined) return null;
const yes = e.yesNeeded;
const no = e.noNeeded;
const quorum = e.quorum;
const title = i18n.plural('vote.need.title', quorum);
if (e.cast === 0) {
return { long: i18n.plural('vote.need.first', quorum, { yes, quorum }), short: t('vote.need.short.first', { yes, quorum }), title };
}
if (no === 0) return { long: t('vote.need.quorum', { yes }), short: t('vote.need.short.quorum', { yes }), title };
return { long: t('vote.need', { yes, no }), short: t('vote.need.short', { yes, no }), title };
}