WIP lot V : le tampon câblé dans le serveur (migration 0010, simulation, discard-simulation), tests en cours de reprise — repris tel quel après la coupure du 02/11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-11-03 05:22:24 +01:00
co-authored by Claude Opus 5.5
parent ee37c3b4d5
commit 4b81a2e909
16 changed files with 1503 additions and 213 deletions
+6 -1
View File
@@ -192,15 +192,20 @@ pub async fn run(state: &AppState, doc_id: &str) -> AppResult<Vec<Entered>> {
/// What an adoption keeps of the formula it was judged by. The four letters
/// stay where the rows of before have them (`majority_pct`, `gradient`, `base`,
/// `constant`: read as they were written); the level and the scale join them.
/// `constant`: read as they were written); the level and the scale join them —
/// and, for the act that ends the simulation (ADR 0012, `simulation::discard`),
/// the simulated share of the votes it entered with, the version it displaced
/// and the level of inertia of before.
fn kept_params(st: &DocState, unit: &docs::UnitRow, p: &docs::ProposalRow) -> serde_json::Value {
let level = st.voting_level(unit, p);
let f = st.scale().params(level);
let simulated = st.simulated_counted(&p.id);
serde_json::json!({
"majority_pct": f.majority_pct, "gradient": f.gradient, "base": f.base, "constant": f.constant,
"level": level, "share_pct": level.share_pct(),
"participation": st.participation.ratio, "participation_source": st.participation.source,
"participation_sample": st.participation.sample, "participation_median": st.participation.median,
"simulated": simulated, "displaced": unit.in_force_id, "from_inertia": docs::inertia_of(unit),
})
}