Lot T4 : les textes et la structure de l'Acte d'engagement (Yvv, 03/11) — I1, E1, E2 prennent les textes d'Yvv (fr, en, es ; « il y a une et une seule clé » lu comme la coquille de « il n'y a une et une seule ») ; E12 « Responsabilité civique », Proposition seed au cran 2, entre E1 et E2 ; les sections formule, inertie, ordonnancement sortent du document (ADR 0014). Migration 0012 additive (units.retired_at et retired_reason, retirement_amendments, article_amendments) ; une unité retirée n'est ni lue avec son document, ni listée, ni votée, ni proposée, corrigée, traduite ou objectée (404), ni comptée, ni publiée ; rien d'effacé. Amendements gardés, une fois par document : 2026-11-03-i1-amorce, -e1-amorce, -e2-amorce (Version::SeedProposal ; la ligne seed_proposal admise quand l'amendement de Proposition seed l'a écrite), 2026-11-03-e12-responsabilite-civique (article_amend : entre E1 et E2 tant que l'ordre de la section n'a pas de vote, sinon en fin de section), 2026-11-03-fonctionnement-hors-vote (retire : tous ou aucun, refus à la moindre trace d'une personne, avec sa raison et l'unité) ; les amendements dont le seed ne donne plus le texte, dépassés (superseded_by) ; seed::write_unit partagé
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -156,10 +156,12 @@ pub async fn group(
|
||||
sqlx::query_as::<_, DocListRow>(
|
||||
"SELECT d.id, d.slug, d.title, d.summary,
|
||||
(SELECT COUNT(*) FROM units u
|
||||
WHERE u.doc_id = d.id AND u.kind = 'article' AND u.in_force_id IS NOT NULL) AS in_force,
|
||||
-- Articles in force; open proposals of articles and modules alike (ADR 0009).
|
||||
WHERE u.doc_id = d.id AND u.kind = 'article' AND u.in_force_id IS NOT NULL
|
||||
AND u.retired_at IS NULL) AS in_force,
|
||||
-- Articles in force; open proposals of articles and modules alike (ADR 0009);
|
||||
-- nothing of a unit out of the document (ADR 0014).
|
||||
(SELECT COUNT(*) FROM proposals p JOIN units u ON u.id = p.unit_id
|
||||
WHERE u.doc_id = d.id AND p.status = 'open') AS open
|
||||
WHERE u.doc_id = d.id AND p.status = 'open' AND u.retired_at IS NULL) AS open
|
||||
FROM documents d WHERE d.group_slug = ? ORDER BY d.created_at",
|
||||
)
|
||||
.bind(&slug)
|
||||
@@ -298,7 +300,7 @@ pub fn inertia_of(unit: &UnitRow) -> InertiaLevel {
|
||||
pub struct DocState {
|
||||
pub doc: DocRow,
|
||||
pub group: GroupRow,
|
||||
/// Every unit, articles and modules, by position.
|
||||
/// Every unit in the document, articles and modules, by position: none retired (ADR 0014).
|
||||
pub units: Vec<UnitRow>,
|
||||
/// The units that are modules (ADR 0009), by unit id; any other is an article.
|
||||
pub module_kinds: HashMap<String, ModuleKind>,
|
||||
@@ -359,14 +361,17 @@ pub async fn electorate(state: &AppState, group: &GroupRow) -> AppResult<(u32, &
|
||||
pub async fn load_state(state: &AppState, doc_id: &str) -> AppResult<DocState> {
|
||||
let doc = load_doc(state, doc_id).await?;
|
||||
let group = load_group(state, &doc.group_slug).await?;
|
||||
// The units in the document: a unit retired (ADR 0014) is not read, nor its versions —
|
||||
// neither listed, nor counted, nor voted on, nor published (`retire`).
|
||||
let units = sqlx::query_as::<_, UnitRow>(
|
||||
"SELECT id, code, section, position, inertia, in_force_id, quorum FROM units WHERE doc_id = ? ORDER BY position, id",
|
||||
"SELECT id, code, section, position, inertia, in_force_id, quorum FROM units
|
||||
WHERE doc_id = ? AND retired_at IS NULL ORDER BY position, id",
|
||||
)
|
||||
.bind(doc_id)
|
||||
.fetch_all(&state.db)
|
||||
.await?;
|
||||
let kinds: Vec<(String, String)> =
|
||||
sqlx::query_as("SELECT id, kind FROM units WHERE doc_id = ? AND kind <> 'article'")
|
||||
sqlx::query_as("SELECT id, kind FROM units WHERE doc_id = ? AND kind <> 'article' AND retired_at IS NULL")
|
||||
.bind(doc_id)
|
||||
.fetch_all(&state.db)
|
||||
.await?;
|
||||
@@ -375,7 +380,7 @@ pub async fn load_state(state: &AppState, doc_id: &str) -> AppResult<DocState> {
|
||||
// Same second (the variants of a seed): the order they were written in, not their
|
||||
// random identifiers. The engine ranks rivals on its own; this order is what people see.
|
||||
let proposals = sqlx::query_as::<_, ProposalRow>(&format!(
|
||||
"{PROPOSAL_SELECT} WHERE p.unit_id IN (SELECT id FROM units WHERE doc_id = ?)
|
||||
"{PROPOSAL_SELECT} WHERE p.unit_id IN (SELECT id FROM units WHERE doc_id = ? AND retired_at IS NULL)
|
||||
AND p.status IN ('open', 'in_force', 'draft') ORDER BY p.submitted_at, p.created_at, p.rowid"
|
||||
))
|
||||
.bind(doc_id)
|
||||
|
||||
Reference in New Issue
Block a user