public_state() feeds both the server-rendered home (works without JavaScript) and GET /stato/, so they cannot disagree: none, open, closing, drawing, paying and maintenance, the round's own quota, the winner's 70% of the *confirmed* pool, bets in flight apart, and the closing time on the server's clock. home.js counts down against the server clock and polls every 5 s while visible. Checked in headless Chromium on mobile and desktop widths. Also records the profile reports (WEB-55, roadmap A9) and the name-lock trade-off (LIM-24). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
14 lines
545 B
Python
14 lines
545 B
Python
"""Amounts for people: integer satoshi in, Italian text out (1 PLM = 100,000,000 sat)."""
|
|
|
|
from .models import SATS_PER_PLM
|
|
|
|
|
|
def plm_text(sats: int) -> str:
|
|
"""`1000000000` -> `10 PLM`, `70000000` -> `0,7 PLM`, `123450000000` -> `1.234,5 PLM`. Never rounds: the decimals shown
|
|
are exactly the satoshi that exist."""
|
|
whole, fraction = divmod(abs(int(sats)), SATS_PER_PLM)
|
|
text = f"{whole:,}".replace(",", ".")
|
|
if fraction:
|
|
text += "," + f"{fraction:08d}".rstrip("0")
|
|
return f"{'-' if sats < 0 else ''}{text} PLM"
|