fix(erp-cc-kpi-skills-brains-keys): Truth Registry schema real keys - skills.TOTAL (not count_total) = 15509 - brains peut etre Array length - fetcher JS mis a jour sk.TOTAL puis fallback count_total et count_unique - Array.isArray check pour brains - GOLD wtp_kpi_fix preserve - chattr safe - HTTP 200 valide live - cause racine mon fetcher utilisait count_total qui n existe pas dans schema Truth Registry V107 - zero regression additif pur
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled

This commit is contained in:
opus
2026-04-21 11:38:01 +02:00
parent c97f02370b
commit cfdfbbcc00

View File

@@ -3013,12 +3013,11 @@ if (typeof window.navigateTo === 'function'){
const br = tr.brains || {};
if (ag.count_unique) document.getElementById('erp-kpi-agents').textContent = ag.count_unique;
// skills count may be number or object with total
let skc = typeof sk === 'number' ? sk : (sk.count_total || sk.count || (sk.items && sk.items.length) || 0);
if (!skc && typeof sk === 'object') {
skc = Object.values(sk).reduce((a,b) => a + (typeof b === 'number' ? b : 0), 0);
}
// Skills: Truth Registry uses .TOTAL key (15509)
let skc = typeof sk === 'number' ? sk : (sk.TOTAL || sk.count_total || sk.count_unique || 0);
if (skc) document.getElementById('erp-kpi-skills').textContent = skc.toLocaleString('fr-FR');
let brc = typeof br === 'number' ? br : (br.count || (br.items && br.items.length) || 0);
// Brains may be array
let brc = typeof br === 'number' ? br : (Array.isArray(br) ? br.length : (br.count || (br.items && br.items.length) || 0));
if (brc) document.getElementById('erp-kpi-brains').textContent = brc;
} catch(e) { /* silent */ }