diff --git a/ft-app/Dockerfile b/ft-app/Dockerfile index 2f2e976..1817013 100644 --- a/ft-app/Dockerfile +++ b/ft-app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.13.11-slim WORKDIR /app diff --git a/ft-app/app/routers/option_trades.py b/ft-app/app/routers/option_trades.py index 11810af..c23d53b 100644 --- a/ft-app/app/routers/option_trades.py +++ b/ft-app/app/routers/option_trades.py @@ -116,8 +116,8 @@ def edit_trade( open_price: float = Form(...), open_fee: float = Form(0.0), close_date: str = Form(""), - close_price: float = Form(None), - close_fee: float = Form(None), + close_price: str = Form(""), + close_fee: str = Form(""), db: Session = Depends(get_db), ): t = db.query(OptionTrade).filter(OptionTrade.id == trade_id).first() @@ -132,10 +132,10 @@ def edit_trade( t.open_date = date.fromisoformat(open_date) t.open_price = open_price t.open_fee = open_fee - if close_date and close_price is not None: + if close_date and close_price: t.close_date = date.fromisoformat(close_date) - t.close_price = close_price - t.close_fee = close_fee or 0 + t.close_price = float(close_price) + t.close_fee = float(close_fee) if close_fee else 0.0 db.commit() return RedirectResponse("/options/", status_code=303) diff --git a/ft-app/app/routers/trades.py b/ft-app/app/routers/trades.py index 50b4cd5..d07ad7a 100644 --- a/ft-app/app/routers/trades.py +++ b/ft-app/app/routers/trades.py @@ -119,8 +119,8 @@ def edit_trade( open_price: float = Form(...), open_fee: float = Form(0.0), close_date: str = Form(""), - close_price: float = Form(None), - close_fee: float = Form(None), + close_price: str = Form(""), + close_fee: str = Form(""), db: Session = Depends(get_db), ): t = db.query(Trade).filter(Trade.id == trade_id).first() @@ -133,10 +133,10 @@ def edit_trade( t.open_date = date.fromisoformat(open_date) t.open_price = open_price t.open_fee = open_fee - if close_date and close_price is not None: + if close_date and close_price: t.close_date = date.fromisoformat(close_date) - t.close_price = close_price - t.close_fee = close_fee or 0 + t.close_price = float(close_price) + t.close_fee = float(close_fee) if close_fee else 0.0 db.commit() return RedirectResponse("/trades/", status_code=303)