Fix: Energie-Dashboard Nodes größer (R=56), Labels aus API, Abrechnungsperiode konfig. (v1.7.1)
- SVG-Nodes: Radius 44 → 56, Icon 22 → 26px, Abstände neu berechnet - Segment-Pfade an neue Positionen angepasst (40px Abstand Kante→Kante) - period.monthly.label / yearly.label statt hardcoded "Diesen Monat" / "Dieses Jahr" - billing_day/billing_month: history.period_key(), /api/period-energy, Settings-UI Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,10 +52,22 @@ def init_db():
|
||||
log.info("History DB initialisiert: %s", DB_PATH)
|
||||
|
||||
|
||||
def period_key(period_type: str) -> str:
|
||||
def period_key(period_type: str, billing_day: int = 1, billing_month: int = 1) -> str:
|
||||
import datetime
|
||||
now = datetime.date.today()
|
||||
return now.strftime("%Y-%m") if period_type == "monthly" else now.strftime("%Y")
|
||||
today = datetime.date.today()
|
||||
if period_type == "monthly":
|
||||
return today.strftime("%Y-%m")
|
||||
# Jahresperiode: Beginn = letzter Abrechnungsstichtag
|
||||
try:
|
||||
start = datetime.date(today.year, billing_month, billing_day)
|
||||
except ValueError:
|
||||
start = datetime.date(today.year, billing_month, 1)
|
||||
if today < start:
|
||||
try:
|
||||
start = datetime.date(today.year - 1, billing_month, billing_day)
|
||||
except ValueError:
|
||||
start = datetime.date(today.year - 1, billing_month, 1)
|
||||
return start.isoformat() # z.B. "2025-04-01"
|
||||
|
||||
|
||||
def save_period_start_if_new(agg_id: str, period_type: str, key: str, current_value: float):
|
||||
|
||||
Reference in New Issue
Block a user