Add interactive citizen page with sidebar, display settings, and adaptive CSS
Major rework of the citizen-facing page: - Chart + sidebar layout (auth/vote/countdown in right sidebar) - DisplaySettings component (font size, chart density, color palettes) - Adaptive CSS with clamp() throughout, responsive breakpoints at 480/768/1024 - Baseline charts zoomed on first tier for small consumption detail - Marginal price chart with dual Y-axes (foyers left, €/m³ right) - Key metrics banner (5 columns: recettes, palier, prix palier, prix médian, mon prix) - Client-side p0/impacts computation, draggable median price bar - Household dots toggle, vote overlay curves - Auth returns volume_m3, vote captures submitted_at - Cleaned header nav (removed Accueil/Super Admin for public visitors) - Terminology: foyer for bills, électeur for votes - 600m³ added to impact reference volumes - Realistic seed votes (50 votes, 3 profiles) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,11 +56,14 @@ def compute_linear_tariff(
|
||||
price_m3_rp = abop / vv + p0
|
||||
price_m3_rs = abos / vv + p0
|
||||
|
||||
def sanitize(arr):
|
||||
return [0.0 if (x != x or x == float('inf') or x == float('-inf')) else float(x) for x in arr]
|
||||
|
||||
return LinearTariffResult(
|
||||
p0=p0,
|
||||
curve_volumes=vv.tolist(),
|
||||
curve_bills_rp=bills_rp.tolist(),
|
||||
curve_bills_rs=bills_rs.tolist(),
|
||||
curve_price_m3_rp=price_m3_rp.tolist(),
|
||||
curve_price_m3_rs=price_m3_rs.tolist(),
|
||||
curve_volumes=sanitize(vv),
|
||||
curve_bills_rp=sanitize(bills_rp),
|
||||
curve_bills_rs=sanitize(bills_rs),
|
||||
curve_price_m3_rp=sanitize(price_m3_rp),
|
||||
curve_price_m3_rs=sanitize(price_m3_rs),
|
||||
)
|
||||
|
||||
@@ -138,13 +138,16 @@ def compute_tariff(
|
||||
a1, a2, b2 = compute_integrals(vol, vinf, vmax, pmax, a, b, c, d, e)
|
||||
household_bills.append(abo + (a1 + a2) * p0 + b2)
|
||||
|
||||
def sanitize(arr):
|
||||
return [0.0 if (x != x or x == float('inf') or x == float('-inf')) else float(x) for x in arr]
|
||||
|
||||
return TariffResult(
|
||||
p0=p0,
|
||||
curve_volumes=vv.tolist(),
|
||||
curve_prices_m3=prix_m3.tolist(),
|
||||
curve_bills_rp=bills_rp.tolist(),
|
||||
curve_bills_rs=bills_rs.tolist(),
|
||||
household_bills=household_bills,
|
||||
curve_volumes=sanitize(vv),
|
||||
curve_prices_m3=sanitize(prix_m3),
|
||||
curve_bills_rp=sanitize(bills_rp),
|
||||
curve_bills_rs=sanitize(bills_rs),
|
||||
household_bills=sanitize(household_bills),
|
||||
)
|
||||
|
||||
|
||||
@@ -169,7 +172,7 @@ def compute_impacts(
|
||||
Returns (p0, list of ImpactRow).
|
||||
"""
|
||||
if reference_volumes is None:
|
||||
reference_volumes = [30, 60, 90, 150, 300]
|
||||
reference_volumes = [30, 60, 90, 150, 300, 600]
|
||||
|
||||
p0 = compute_p0(households, recettes, abop, abos, vinf, vmax, pmax, a, b, c, d, e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user