Membership-System und Bug Fixing (inkl. Nutrition) #8
|
|
@ -153,7 +153,9 @@ def nutrition_weekly(weeks: int=16, x_profile_id: Optional[str]=Header(default=N
|
||||||
if not rows: return []
|
if not rows: return []
|
||||||
wm={}
|
wm={}
|
||||||
for d in rows:
|
for d in rows:
|
||||||
wk=datetime.strptime(d['date'],'%Y-%m-%d').strftime('%Y-W%V')
|
# Handle both datetime.date objects (from DB) and strings
|
||||||
|
date_obj = d['date'] if hasattr(d['date'], 'strftime') else datetime.strptime(d['date'],'%Y-%m-%d')
|
||||||
|
wk = date_obj.strftime('%Y-W%V')
|
||||||
wm.setdefault(wk,[]).append(d)
|
wm.setdefault(wk,[]).append(d)
|
||||||
result=[]
|
result=[]
|
||||||
for wk in sorted(wm):
|
for wk in sorted(wm):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user