fix(admin): include all tasks in overview

go
codex 4 weeks ago
parent 02e075254c
commit 900faa3eeb

@ -163,8 +163,7 @@ final class CloudAdminOverviewService
private static function jobs(int $now, int $todayStart, int $tomorrow): array
{
$dayAgo = $now - self::DAY;
$row = CloudJob::where('kind', 'create')
->whereNotNull('order_id')
$row = CloudJob::query()
->where(function ($query) use ($dayAgo) {
$query->where('phase', '<>', 'terminal')
->orWhere(function ($failed) use ($dayAgo) {

@ -65,6 +65,10 @@ $assert(str_contains($service, "where('status', 'paid')")
&& str_contains($service, "modify('+1 day')"),
'Financial, instance and job overview boundaries are incomplete.');
$assert(str_contains($service, '$row = CloudJob::query()')
&& str_contains($service, '$today = CloudJob::where(\'kind\', \'create\')'),
'Operational task cards must cover every task while business-flow totals remain provisioning-only.');
$assert(str_contains($service, "foreach (\$window['trend'] as \$index => \$day)")
&& substr_count($service, 'CloudInvoice::where') <= 3,
'Revenue trend must use bounded aggregate queries rather than one query per day.');

@ -99,6 +99,10 @@ Capsule::table('cloud_jobs')->insert([
'outcome' => null, 'effect_resolution' => 'not_applicable',
'terminal_at' => null, 'status' => 'running',
'created_at' => $today + 20, 'updated_at' => $now],
['order_id' => null, 'kind' => 'rescue', 'phase' => 'terminal',
'outcome' => 'failed', 'effect_resolution' => 'unknown',
'terminal_at' => $now - 25, 'status' => 'failed',
'created_at' => $today + 25, 'updated_at' => $now],
['order_id' => 2, 'kind' => 'create', 'phase' => 'terminal',
'outcome' => 'failed', 'effect_resolution' => 'unknown',
'terminal_at' => $now - 30, 'status' => 'failed',
@ -176,13 +180,13 @@ $assert($overview['instances']['managed'] === 4
&& $overview['instances']['expiring_7d'] === 1
&& $overview['instances']['grace'] === 1,
'Instance lifecycle aggregation is incorrect.');
$assert($overview['jobs']['active'] === 1
&& $overview['jobs']['unresolved_effect'] === 2
&& $overview['jobs']['failed_24h'] === 3
$assert($overview['jobs']['active'] === 2
&& $overview['jobs']['unresolved_effect'] === 3
&& $overview['jobs']['failed_24h'] === 4
&& $overview['jobs']['today_total'] === 5
&& $overview['jobs']['today_succeeded'] === 2
&& $overview['jobs']['today_failed'] === 3,
'Job aggregation must use terminal time and exclude lifecycle-only work.');
'Global job aggregation must include non-provisioning work while today totals remain provisioning-only.');
$assert($overview['attention_total'] === $overview['jobs']['unresolved_effect']
+ $overview['jobs']['failed_24h']
+ $overview['instances']['network_attention']

Loading…
Cancel
Save