Fix critical bugs + add zoom/overlay for citizen chart
Bugs fixed: - Auth middleware now works on page refresh (plugin restores auth from localStorage before middleware runs) - Bezier drag no longer snaps back: removed client-side p0 recalculation during drag, only server computes p0 on mouseUp - Removed redundant /login.vue page (homepage already has links) New features: - Interactive zoom on Bezier chart (buttons + mouse wheel + tier 1/tier 2 presets) - Toggle to display outlier vote curves (public overlay endpoint) - Tier 1 curve visually emphasized (thicker stroke) - Dev credentials file at data/DEV-CREDENTIALS.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,23 @@ async def _load_commune_context(commune_id: int, db: AsyncSession):
|
||||
return params, households
|
||||
|
||||
|
||||
# ── Public endpoint: overlay of all vote curves for citizens ──
|
||||
|
||||
@router.get("/communes/{slug}/votes/current/overlay")
|
||||
async def current_overlay(slug: str, db: AsyncSession = Depends(get_db)):
|
||||
"""Public: returns all active vote curves (params only, no auth required)."""
|
||||
commune = await _get_commune_by_slug(slug, db)
|
||||
result = await db.execute(
|
||||
select(Vote).where(Vote.commune_id == commune.id, Vote.is_active == True)
|
||||
)
|
||||
votes = result.scalars().all()
|
||||
return [
|
||||
{"vinf": v.vinf, "a": v.a, "b": v.b,
|
||||
"c": v.c, "d": v.d, "e": v.e, "computed_p0": v.computed_p0}
|
||||
for v in votes
|
||||
]
|
||||
|
||||
|
||||
# ── Public endpoint: current median curve for citizens ──
|
||||
|
||||
@router.get("/communes/{slug}/votes/current")
|
||||
|
||||
Reference in New Issue
Block a user