You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
677 B
22 lines
677 B
<?php
|
|
|
|
namespace App\Statists;
|
|
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class SystemStatist implements Pipe
|
|
{
|
|
public function handle($tasks, $next)
|
|
{
|
|
$key = 'systems.'. ($task->system_id ?? 0) . '.' . ($task->assignee_id ?? 0) .
|
|
'.' . $task->workflow_id . '.' . $task->status_id;
|
|
$node = Arr::get($result, $key, ['total' => 0, 'test' => 0, 'overdue' => 0]);
|
|
$node['total'] = $node['total'] + 1;
|
|
$node['test'] = $node['test'] + $task->ready_to_test;
|
|
$node['overdue'] = $node['overdue'] + ($task->on_time? 0: 1);
|
|
Arr::set($result, $key, $node);
|
|
|
|
return $next($tasks);
|
|
}
|
|
}
|