AnayShukla commited on
Commit
031faff
·
1 Parent(s): 7ab3765

player fix

Browse files
Files changed (2) hide show
  1. frontend/src/PlayerContext.jsx +2 -0
  2. main.py +2 -1
frontend/src/PlayerContext.jsx CHANGED
@@ -315,6 +315,8 @@ export const PlayerProvider = ({ children }) => {
315
  const origBaseline = p.baseline_xMins || 90;
316
  const baselineScale = (manualBaseline != null && origBaseline > 0) ? (Number(manualBaseline) / origBaseline) : 1.0;
317
 
 
 
318
  Object.entries(p.match_projections).forEach(([matchId, mData]) => {
319
  const override = effectiveFixtures[matchId];
320
 
 
315
  const origBaseline = p.baseline_xMins || 90;
316
  const baselineScale = (manualBaseline != null && origBaseline > 0) ? (Number(manualBaseline) / origBaseline) : 1.0;
317
 
318
+ if (!p.match_projections || typeof p.match_projections !== 'object' || Array.isArray(p.match_projections)) return;
319
+
320
  Object.entries(p.match_projections).forEach(([matchId, mData]) => {
321
  const override = effectiveFixtures[matchId];
322
 
main.py CHANGED
@@ -505,9 +505,10 @@ def update_player(req: UpdateRequest):
505
  if req.is_admin and app_data.output_df is not None:
506
  idx = app_data.output_df[app_data.output_df["ID"] == req.player_id].index
507
  if not idx.empty:
 
508
  for col in updated_row_df.columns:
509
  if col in app_data.output_df.columns:
510
- app_data.output_df.loc[idx, col] = updated_row_df[col].values[0]
511
  return updated_row_df.iloc[0].to_dict()
512
 
513
 
 
505
  if req.is_admin and app_data.output_df is not None:
506
  idx = app_data.output_df[app_data.output_df["ID"] == req.player_id].index
507
  if not idx.empty:
508
+ row_idx = idx[0]
509
  for col in updated_row_df.columns:
510
  if col in app_data.output_df.columns:
511
+ app_data.output_df.at[row_idx, col] = updated_row_df[col].values[0]
512
  return updated_row_df.iloc[0].to_dict()
513
 
514