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

  1. <?php
  2. namespace App\Statists;
  3. use Illuminate\Support\Arr;
  4. use Illuminate\Support\Facades\Cache;
  5. class SystemStatist implements Pipe
  6. {
  7. public function handle($tasks, $next)
  8. {
  9. $key = 'systems.'. ($task->system_id ?? 0) . '.' . ($task->assignee_id ?? 0) .
  10. '.' . $task->workflow_id . '.' . $task->status_id;
  11. $node = Arr::get($result, $key, ['total' => 0, 'test' => 0, 'overdue' => 0]);
  12. $node['total'] = $node['total'] + 1;
  13. $node['test'] = $node['test'] + $task->ready_to_test;
  14. $node['overdue'] = $node['overdue'] + ($task->on_time? 0: 1);
  15. Arr::set($result, $key, $node);
  16. return $next($tasks);
  17. }
  18. }