Task calendar (/jobs/calendar) replaces per-unit task Kanban columns (K34): a two-week Gantt of tasks per person. Bars move, resize and change person by dragging or through a keyboard dialog. Each task's estimate is booked evenly over working days into task_bookings, and what exceeds the daily maximum (jobs.daily_capacity_hours, 8 h) moves to the next working day. Tasks get planned_from/planned_to on the form. Holidays (/settings/holidays): Finnish public holidays calculated per year, which the admin can take out of use, plus company days off. Also includes the earlier uncommitted work: workflow templates with adding tasks from a template, and removing customers no module refers to. Co-Authored-By: Claude Opus 5.5 <[email protected]>
59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Fakes;
|
|
|
|
use App\Modules\Jobs\Domain\Contracts\TaskRepository;
|
|
use App\Modules\Jobs\Domain\Entities\Task;
|
|
|
|
class InMemoryTaskRepository implements TaskRepository
|
|
{
|
|
/** @var array<int, Task> */
|
|
public array $tasks = [];
|
|
|
|
private int $nextId = 1;
|
|
|
|
public function findForJob(int $jobId, int $taskId): ?Task
|
|
{
|
|
$task = $this->tasks[$taskId] ?? null;
|
|
|
|
return $task !== null && $task->jobId() === $jobId ? clone $task : null;
|
|
}
|
|
|
|
public function findByWorkType(int $jobId, int $workTypeId): ?Task
|
|
{
|
|
foreach ($this->tasks as $task) {
|
|
if ($task->jobId() === $jobId && $task->workTypeId() === $workTypeId) {
|
|
return clone $task;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public function save(Task $task): Task
|
|
{
|
|
$id = $task->id() ?? $this->nextId++;
|
|
$this->tasks[$id] = Task::reconstitute(
|
|
$id,
|
|
$task->jobId(),
|
|
$task->workTypeId(),
|
|
$task->title(),
|
|
$task->description(),
|
|
$task->status(),
|
|
$task->dueOn(),
|
|
$task->estimatedHours(),
|
|
$task->assigneeUserIds(),
|
|
$task->createdBy(),
|
|
$task->plannedFrom(),
|
|
$task->plannedTo(),
|
|
);
|
|
|
|
return clone $this->tasks[$id];
|
|
}
|
|
|
|
public function delete(Task $task): void
|
|
{
|
|
unset($this->tasks[$task->id()]);
|
|
}
|
|
}
|