fix: Correctly handle query results in trading plan retrieval functions
This commit is contained in:
parent
1d423d3291
commit
5acfe4bfc4
@ -209,10 +209,12 @@ def get_trading_plan(plan_id: int) -> Optional[TradingPlan]:
|
||||
SELECT * FROM trading_plans WHERE id = %(id)s
|
||||
""", {'id': plan_id})
|
||||
|
||||
if not result:
|
||||
rows = result.result_rows
|
||||
|
||||
if not rows:
|
||||
return None
|
||||
|
||||
plan = result[0]
|
||||
plan = rows[0]
|
||||
return TradingPlan(
|
||||
id=plan[0],
|
||||
plan_name=plan[1],
|
||||
@ -267,7 +269,7 @@ def get_all_trading_plans(status: Optional[PlanStatus] = None) -> List[TradingPl
|
||||
query += " ORDER BY updated_at DESC"
|
||||
|
||||
results = client.query(query, params)
|
||||
rows = results.result_rows # Ensure this is the correct method to access rows
|
||||
rows = results.result_rows
|
||||
return [TradingPlan(
|
||||
id=row[0],
|
||||
plan_name=row[1],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user