refactor(helpdesk): remove resolution time dimension from risk score

Resolution time measures the past, not current risk. The remaining
4 dimensions (open pressure 35%, trend 30%, SLA overdue 25%,
inactivity 10%) are all current and actionable. Removes resolution
aggregation, median calculation, and weight redistribution logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 00:47:58 +02:00
parent d5d1e22e87
commit 28cb60efb3
2 changed files with 9 additions and 68 deletions

View File

@@ -134,40 +134,16 @@ class RiskRadarServiceTest extends TestCase
$this->assertSame(0, $result['customers'][0]['kpis']['sla_overdue']);
}
public function testResolutionMedian(): void
public function testFourDimensionsInOutput(): void
{
$tickets = [
self::ticket('T1', '10610', 'Fast', 100, true, '', 10),
self::ticket('T2', '10610', 'Fast', 100, true, '', 20),
self::ticket('T3', '10610', 'Fast', 100, true, '', 30),
self::ticket('T4', '10610', 'Fast', 5), // one open
self::ticket('T1', '10610', 'Any', 10),
];
$result = RiskRadarService::buildRiskRadar($tickets, [], 90);
$this->assertSame(20.0, $result['customers'][0]['kpis']['resolution_median_hours']);
}
public function testResolutionNullRedistributesWeight(): void
{
// Only open tickets, no closed → resolution is null
$tickets = [
self::ticket('T1', '10610', 'Open Only', 10),
];
$result = RiskRadarService::buildRiskRadar($tickets, [], 90);
$customer = $result['customers'][0];
$resolutionDim = null;
foreach ($customer['dimensions'] as $d) {
if ($d['id'] === 'resolution') {
$resolutionDim = $d;
}
}
$this->assertNotNull($resolutionDim);
$this->assertNull($resolutionDim['dimension_score']);
$this->assertSame(0.0, $resolutionDim['weighted_points']);
$dimIds = array_column($result['customers'][0]['dimensions'], 'id');
$this->assertSame(['open_pressure', 'trend', 'sla_overdue', 'inactivity'], $dimIds);
}
public function testTruncatedFlagPassthrough(): void