portal: /broker/money-series, so members chart the co-op's money beside its other charts
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
The member dashboard could not show the money chart because the broker exposed no money series — the same payload /admin/money-series serves the panel is aggregate and carries no member identities (cumulative revenue, cumulative token spend, the OC balance), so it goes through the broker for the same reason /broker/metrics does. One chart definition, drawn identically for members and stewards.
This commit is contained in:
1 parent
0d5ffede05
commit
9af0604f47
1 file changed
+21
+21
@@ -6651,6 +6651,27 @@ async def broker_metrics(request: Request, days: int = 90):
|
|||||||
return {"series": series, "count": len(series), "days": max(1, min(int(days or 90), 730))}
|
return {"series": series, "count": len(series), "days": max(1, min(int(days or 90), 730))}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/broker/money-series")
|
||||||
|
@limiter.limit("30/minute")
|
||||||
|
async def broker_money_series(request: Request):
|
||||||
|
"""Revenue / token-spend / OC-balance series, for the member dashboard.
|
||||||
|
|
||||||
|
The same payload /admin/money-series serves the panel, through the broker for
|
||||||
|
the same reason /broker/metrics is: it is AGGREGATE and carries no member
|
||||||
|
identities — cumulative revenue, cumulative token spend, and the co-op's
|
||||||
|
Open Collective balance. The co-op's own finances are not private to
|
||||||
|
stewards here: the member dashboard charts them next to the other co-op
|
||||||
|
charts, from the shared chart definitions, so members and stewards see the
|
||||||
|
same picture. Hourly-cached (the OC queries are slow).
|
||||||
|
|
||||||
|
The balance series exists only from the day the snapshots began (the OC API
|
||||||
|
exposes just the CURRENT balance) — a chart must render that as a gap, never
|
||||||
|
as a zero, which is what the shared renderer does.
|
||||||
|
"""
|
||||||
|
_verify_broker_secret(request)
|
||||||
|
return await _get_money_payload()
|
||||||
|
|
||||||
|
|
||||||
@app.get("/broker/model-leaderboard")
|
@app.get("/broker/model-leaderboard")
|
||||||
@limiter.limit("30/minute")
|
@limiter.limit("30/minute")
|
||||||
async def broker_model_leaderboard(request: Request, days: int = 0):
|
async def broker_model_leaderboard(request: Request, days: int = 0):
|
||||||
|
|||||||
Reference in new issue
Block a user