fixing db tables and onplace upgrde

This commit is contained in:
2025-10-02 05:46:58 -07:00
parent ed5839e222
commit 342eceff1f
9 changed files with 271 additions and 12 deletions

View File

@@ -687,10 +687,11 @@ async def tracker_add_food(data: dict = Body(...), db: Session = Depends(get_db)
person = data.get("person")
date_str = data.get("date")
food_id = data.get("food_id")
grams = float(data.get("grams", 1.0))
grams = float(data.get("quantity", 1.0))
meal_time = data.get("meal_time")
logging.info(f"DEBUG: Adding single food to tracker - person={person}, date={date_str}, food_id={food_id}, grams={grams}, meal_time={meal_time}")
logging.info(f"BUG HUNT: Received raw data: {data}")
logging.info(f"BUG HUNT: Parsed grams: {grams}")
# Parse date
from datetime import datetime

View File

@@ -25,7 +25,7 @@ import os
# Database setup - Use SQLite for easier setup
# Use environment variables if set, otherwise use defaults
# Use current directory for database
DATABASE_PATH = os.getenv('DATABASE_PATH', '/app/data')
DATABASE_PATH = os.getenv('DATABASE_PATH', '/app')
DATABASE_URL = os.getenv('DATABASE_URL', f'sqlite:///{DATABASE_PATH}/meal_planner.db')
# For production, use PostgreSQL: DATABASE_URL = "postgresql://username:password@localhost/meal_planner"