jetpackjules Claude commited on
Commit
a56fef7
·
1 Parent(s): 32685f8

Add debugging for date format issue

Browse files

- Added logging to see actual date values being generated
- Refactored to reuse first_buy_order for consistency
- Investigating why dates might appear truncated

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -402,7 +402,9 @@ def refresh_investment_performance_table():
402
  ipo_price = ipo_price_lookup.get(symbol, 0)
403
 
404
  # Get first buy date
405
- first_buy_date = min(buy_orders, key=lambda x: x.filled_at).filled_at.strftime('%Y-%m-%d')
 
 
406
 
407
  # Calculate sell price (average of all sells)
408
  if sell_orders:
@@ -464,7 +466,7 @@ def refresh_investment_performance_table():
464
  'P&L (%)': pl_percent_str,
465
  'Date': first_buy_date,
466
  '_row_bg': row_bg, # Store background color for styling
467
- '_sort_date': min(buy_orders, key=lambda x: x.filled_at).filled_at # Store datetime for sorting
468
  })
469
 
470
  # Sort by date (most recent first)
 
402
  ipo_price = ipo_price_lookup.get(symbol, 0)
403
 
404
  # Get first buy date
405
+ first_buy_order = min(buy_orders, key=lambda x: x.filled_at)
406
+ first_buy_date = first_buy_order.filled_at.strftime('%Y-%m-%d')
407
+ logger.info(f"Date for {symbol}: {first_buy_date} (from {first_buy_order.filled_at})")
408
 
409
  # Calculate sell price (average of all sells)
410
  if sell_orders:
 
466
  'P&L (%)': pl_percent_str,
467
  'Date': first_buy_date,
468
  '_row_bg': row_bg, # Store background color for styling
469
+ '_sort_date': first_buy_order.filled_at # Store datetime for sorting
470
  })
471
 
472
  # Sort by date (most recent first)