@props([
'metricsCurrent' => [],
'metricsLast' => [],
'metricsGlobal' => [],
'metricsPerformance' => [],
'videoResult' => null,
'testDurationSeconds' => 0
])
@php
/**
* colorVRtoM($key,$value):
* Aplica color <70 => rojo, >=90 => verde, else => blanco
* SOLO si $key está en [VRC,VRP,VPS,VPA,M].
*/
function colorVRtoM($key,$val){
if(is_null($val)) return '';
if(!in_array($key,['VRC','VRP','VPS','VPA','M'])) return '';
if($val<=70) return 'bg-danger text-white';
return '';
}
/**
* colorPerformance($perf):
* < -10 => rojo
* > +10 => verde
* else => sin color
*/
function colorPerformance($perf){
if(is_null($perf)) return '';
if($perf<=-10) return 'bg-danger text-white';
return '';
}
@endphp
@foreach($metricsCurrent as $key => $val)
@if(!in_array($key, ['CR_total_correct','CR_total_incorrect','CR_average_time']))
@if($key === 'SIN_VALOR')
{{ __('all.SIN_VALOR') }}
@else
{{ strtoupper($key) }}
@endif
@if(isset($metricsCurrent[$key]))
{{ number_format($metricsCurrent[$key],2) }}%
@else
N/A
@endif
@if(isset($metricsLast[$key]))
{{ number_format($metricsLast[$key],2) }}%
@else
N/A
@endif
@if(isset($metricsGlobal[$key]))
{{ number_format($metricsGlobal[$key],2) }}%
@else
N/A
@endif
@endif
@endforeach
@if(isset($videoResult) && isset($videoResult['length']) && isset($videoResult['length_invalid_pose']) && $testDurationSeconds > 0)
@php
$total_frames = array_sum($videoResult['length']);
$invalid_pose_frames = array_sum($videoResult['length_invalid_pose']);
// Nos aseguramos de que los valores sean válidos
$invalid_pose_frames = min(max(0, $invalid_pose_frames), $total_frames);
// Calculamos el porcentaje
$static_percentage = ($invalid_pose_frames / $total_frames) * 100;
// Calculamos el tiempo Static como un porcentaje del tiempo total
$static_time = $testDurationSeconds * ($static_percentage / 100);
@endphp
{{ gmdate('i:s', (int)$static_time) }}
@else
00:00
@endif
@if(isset($videoResult) && isset($videoResult['length']) && isset($videoResult['length_invalid_pose']) && $testDurationSeconds > 0)
@php
$total_frames = array_sum($videoResult['length']);
$invalid_pose_frames = array_sum($videoResult['length_invalid_pose']);
// Nos aseguramos de que los valores sean válidos
$invalid_pose_frames = min(max(0, $invalid_pose_frames), $total_frames);
// Calculamos el porcentaje
$static_percentage = ($invalid_pose_frames / $total_frames) * 100;
// Calculamos el tiempo Static como un porcentaje del tiempo total
$static_time = $testDurationSeconds * ($static_percentage / 100);
@endphp
{{ gmdate('i:s', (int)$static_time) }}
@else
00:00
@endif
@if(isset($videoResult) && isset($videoResult['length']) && isset($videoResult['length_invalid_pose']) && $testDurationSeconds > 0)
@php
$total_frames = array_sum($videoResult['length']);
$invalid_pose_frames = array_sum($videoResult['length_invalid_pose']);
// Nos aseguramos de que los valores sean válidos
$invalid_pose_frames = min(max(0, $invalid_pose_frames), $total_frames);
// Calculamos el porcentaje
$static_percentage = ($invalid_pose_frames / $total_frames) * 100;
// Calculamos el tiempo Static como un porcentaje del tiempo total
$static_time = $testDurationSeconds * ($static_percentage / 100);
@endphp
{{ gmdate('i:s', (int)$static_time) }}
@else
00:00
@endif