fix: Consistent KPI calculations across tabs

- DimensionAnalysisTab now uses h.metrics.transfer_rate instead of
  h.variability?.transfer_rate for consistency with ExecutiveSummaryTab
  and Law10Tab
- Both fields should have the same value, but using metrics.transfer_rate
  ensures consistency across all tabs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
sujucu70
2026-01-23 11:03:50 +01:00
parent 33d25871ae
commit 0063d299c9

View File

@@ -78,7 +78,7 @@ function generateCausalAnalysis(
? heatmapData.reduce((sum, h) => sum + (h.variability?.cv_aht || 0) * h.volume, 0) / totalVolume ? heatmapData.reduce((sum, h) => sum + (h.variability?.cv_aht || 0) * h.volume, 0) / totalVolume
: 0; : 0;
const avgTransferRate = totalVolume > 0 const avgTransferRate = totalVolume > 0
? heatmapData.reduce((sum, h) => sum + (h.variability?.transfer_rate || 0) * h.volume, 0) / totalVolume ? heatmapData.reduce((sum, h) => sum + h.metrics.transfer_rate * h.volume, 0) / totalVolume
: 0; : 0;
// Usar FCR Técnico (100 - transfer_rate) en lugar de FCR Real (con filtro recontacto 7d) // Usar FCR Técnico (100 - transfer_rate) en lugar de FCR Real (con filtro recontacto 7d)
// FCR Técnico es más comparable con benchmarks de industria // FCR Técnico es más comparable con benchmarks de industria
@@ -99,7 +99,7 @@ function generateCausalAnalysis(
const skillsHighCV = heatmapData.filter(h => (h.variability?.cv_aht || 0) > 100); const skillsHighCV = heatmapData.filter(h => (h.variability?.cv_aht || 0) > 100);
// Usar FCR Técnico para identificar skills con bajo FCR // Usar FCR Técnico para identificar skills con bajo FCR
const skillsLowFCR = heatmapData.filter(h => (h.metrics.fcr_tecnico ?? (100 - h.metrics.transfer_rate)) < 50); const skillsLowFCR = heatmapData.filter(h => (h.metrics.fcr_tecnico ?? (100 - h.metrics.transfer_rate)) < 50);
const skillsHighTransfer = heatmapData.filter(h => (h.variability?.transfer_rate || 0) > 20); const skillsHighTransfer = heatmapData.filter(h => h.metrics.transfer_rate > 20);
// Parsear P50 AHT del KPI del header para consistencia visual // Parsear P50 AHT del KPI del header para consistencia visual
// El KPI puede ser "345s (P50)" o similar // El KPI puede ser "345s (P50)" o similar