matias-cataife commited on
Commit ·
e6eee39
1
Parent(s): ca10378
fix: drawer redraw after manual enrich uses real score from refreshed ALL_PLAYERS
Browse files- static/app.js +11 -18
static/app.js
CHANGED
|
@@ -1376,24 +1376,17 @@ async function enrichByUrl(pid, season, btn) {
|
|
| 1376 |
status.style.color = 'var(--good, #34d399)';
|
| 1377 |
status.textContent = `OK: ${res.scraped._scraped_name || ''} ${res.scraped.tm_market_value || ''}` +
|
| 1378 |
(res.pushed_to_hf ? ' · guardado en dataset HF' : ` · ⚠ no se pudo subir a HF: ${res.push_error || 'unknown'}`);
|
| 1379 |
-
//
|
| 1380 |
-
|
| 1381 |
-
|
| 1382 |
-
|
| 1383 |
-
|
| 1384 |
-
|
| 1385 |
-
|
| 1386 |
-
|
| 1387 |
-
|
| 1388 |
-
|
| 1389 |
-
|
| 1390 |
-
bl: p.blocks || {},
|
| 1391 |
-
};
|
| 1392 |
-
document.getElementById('tableDrawerBody').innerHTML = playerDetailHTML(shaped);
|
| 1393 |
-
} catch (e) { /* keep drawer as-is */ }
|
| 1394 |
-
// also refresh the table so the row picks up the new tm_url + mv
|
| 1395 |
-
refreshFromServer();
|
| 1396 |
-
}, 400);
|
| 1397 |
} catch (e) {
|
| 1398 |
status.style.color = '#f87171';
|
| 1399 |
status.textContent = 'Error: ' + (e.message || e);
|
|
|
|
| 1376 |
status.style.color = 'var(--good, #34d399)';
|
| 1377 |
status.textContent = `OK: ${res.scraped._scraped_name || ''} ${res.scraped.tm_market_value || ''}` +
|
| 1378 |
(res.pushed_to_hf ? ' · guardado en dataset HF' : ` · ⚠ no se pudo subir a HF: ${res.push_error || 'unknown'}`);
|
| 1379 |
+
// Refresh the table FIRST so ALL_PLAYERS picks up the freshly scored row,
|
| 1380 |
+
// then redraw the drawer using the up-to-date row (real ss/ps/pf, not zeroes).
|
| 1381 |
+
try {
|
| 1382 |
+
const result = await API.score(buildScorePayload());
|
| 1383 |
+
ALL_PLAYERS = result.rows;
|
| 1384 |
+
if (typeof onFilterChange === 'function') onFilterChange();
|
| 1385 |
+
} catch (e) { /* keep going */ }
|
| 1386 |
+
const updated = ALL_PLAYERS.find(p => p.pid === pid && (p.t || '') === (season || ''));
|
| 1387 |
+
if (updated) {
|
| 1388 |
+
document.getElementById('tableDrawerBody').innerHTML = playerDetailHTML(updated);
|
| 1389 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1390 |
} catch (e) {
|
| 1391 |
status.style.color = '#f87171';
|
| 1392 |
status.textContent = 'Error: ' + (e.message || e);
|