Flexibles KI Prompt System #48

Merged
Lars merged 56 commits from develop into main 2026-03-26 14:49:48 +01:00
Showing only changes of commit dfaf24d74c - Show all commits

View File

@ -65,13 +65,13 @@ def get_latest_bf(profile_id: str) -> Optional[str]:
with get_db() as conn:
cur = get_cursor(conn)
cur.execute(
"""SELECT bf_jpl FROM caliper_log
WHERE profile_id=%s AND bf_jpl IS NOT NULL
"""SELECT body_fat_pct FROM caliper_log
WHERE profile_id=%s AND body_fat_pct IS NOT NULL
ORDER BY date DESC LIMIT 1""",
(profile_id,)
)
row = cur.fetchone()
return f"{row['bf_jpl']:.1f}%" if row else "nicht verfügbar"
return f"{row['body_fat_pct']:.1f}%" if row else "nicht verfügbar"
def get_nutrition_avg(profile_id: str, field: str, days: int = 30) -> str:
@ -108,8 +108,8 @@ def get_caliper_summary(profile_id: str) -> str:
with get_db() as conn:
cur = get_cursor(conn)
cur.execute(
"""SELECT bf_jpl, bf_katch, date FROM caliper_log
WHERE profile_id=%s AND bf_jpl IS NOT NULL
"""SELECT body_fat_pct, sf_method, date FROM caliper_log
WHERE profile_id=%s AND body_fat_pct IS NOT NULL
ORDER BY date DESC LIMIT 1""",
(profile_id,)
)
@ -118,7 +118,8 @@ def get_caliper_summary(profile_id: str) -> str:
if not row:
return "keine Caliper-Messungen"
return f"JPL: {row['bf_jpl']:.1f}% (Katch: {row['bf_katch']:.1f}% am {row['date']})"
method = row.get('sf_method', 'unbekannt')
return f"{row['body_fat_pct']:.1f}% ({method} am {row['date']})"
def get_circ_summary(profile_id: str) -> str:
@ -126,7 +127,7 @@ def get_circ_summary(profile_id: str) -> str:
with get_db() as conn:
cur = get_cursor(conn)
cur.execute(
"""SELECT brust, taille, huefte, date FROM circumference_log
"""SELECT c_chest, c_waist, c_hip, date FROM circumference_log
WHERE profile_id=%s
ORDER BY date DESC LIMIT 1""",
(profile_id,)
@ -137,9 +138,9 @@ def get_circ_summary(profile_id: str) -> str:
return "keine Umfangsmessungen"
parts = []
if row.get('brust'): parts.append(f"Brust {row['brust']}cm")
if row.get('taille'): parts.append(f"Taille {row['taille']}cm")
if row.get('huefte'): parts.append(f"Hüfte {row['huefte']}cm")
if row.get('c_chest'): parts.append(f"Brust {row['c_chest']:.1f}cm")
if row.get('c_waist'): parts.append(f"Taille {row['c_waist']:.1f}cm")
if row.get('c_hip'): parts.append(f"Hüfte {row['c_hip']:.1f}cm")
return f"{', '.join(parts)} ({row['date']})" if parts else "keine Daten"