Fixed all remaining Decimal → float conversion issues found by audit.
**Fixed Endpoints:**
1. Weight Stats: min/max/avg calculations
2. Activity Stats: kcal/duration accumulation
3. Nutrition Weekly: average calculations
4. Template Variables: all f-string Decimal formatting
5. CSV Export: all numeric value formatting
6. JSON Export: added Decimal handler
7. ZIP Export: added Decimal handler
8. Correlations: weight, nutrition, caliper values
**Changes:**
- Added `from decimal import Decimal` import
- Weight stats: convert to float for min/max/avg
- Activity: float() in sum() and accumulation
- Nutrition: float() in averages
- Template vars: float() for weight_aktuell, kf_aktuell, goals
- CSV: float() in all f-strings (weight, circ, caliper, nutrition, activity)
- JSON/ZIP: custom decimal_handler for json.dumps()
- Correlations: float() for all numeric DB values
Prevents:
- TypeError in math operations
- "Decimal('X')" strings in exports
- JSON serialization failures
All numeric values from PostgreSQL now properly converted to float.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| db_init.py | ||
| db.py | ||
| Dockerfile | ||
| main.py | ||
| migrate_to_postgres.py | ||
| requirements.txt | ||
| schema.sql | ||
| startup.sh | ||