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.
|
|
<?php
namespace App\Statists;
use App\Task; use Illuminate\Support\Arr; use Illuminate\Support\Facades\Cache;
class SprintStatist implements Pipe { private Task $task;
public function __construct($task) { $this->task = $task; }
public function handle(&$result, $next) { $key = 'sprints.'; $key .= ($this->task->sprint_id ?? 0).'.'; $key .= ($this->task->assignee_id ?? 0).'.'; $key .= $this->task->workflow_id . '.'; $key .= $this->task->status_id;
$map = [ 'total' => 0, 'test' => 0, 'overdue' => 0, 'worked' => 0, // total worked in minute
'estimate' => 0, // estimate total
];
$node = Arr::get($result, $key, $map);
$node['total'] = $node['total'] + 1; $node['test'] = $node['test'] + $result->ready_to_test; $node['overdue'] = $node['overdue'] + ($result->on_time? 0 : 1);
Arr::set($result, $key, $node);
return $next($result); } }
|