snapshot schedule source data
This commit is contained in:
parent
14fe2fcb46
commit
f500bd6095
14 changed files with 84 additions and 87 deletions
|
|
@ -70,7 +70,7 @@ class CreateSchedule
|
|||
|
||||
return $this->scheduleRepository->create(new CreateScheduleDto(
|
||||
user: $request->user,
|
||||
set: $set,
|
||||
setName: $set->getName(),
|
||||
elementKind: $request->elementKind,
|
||||
startDate: $startDate,
|
||||
targetDate: $targetDate,
|
||||
|
|
@ -153,7 +153,9 @@ class CreateSchedule
|
|||
dayCount: $dayCount,
|
||||
);
|
||||
$assignments[] = new CreateScheduleAssignmentDto(
|
||||
element: $element,
|
||||
name: $element->getName(),
|
||||
kind: $element->getKind(),
|
||||
path: $this->elementPath($element),
|
||||
scheduledDate: $startDate->modify("+{$dayIndex} days"),
|
||||
position: $index + 1,
|
||||
);
|
||||
|
|
@ -162,6 +164,22 @@ class CreateSchedule
|
|||
return $assignments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function elementPath(Element $element): array
|
||||
{
|
||||
$path = [];
|
||||
$currentElement = $element;
|
||||
|
||||
while ($currentElement !== null) {
|
||||
array_unshift($path, $currentElement->getName());
|
||||
$currentElement = $currentElement->getParentElement();
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
private function dayIndex(
|
||||
int $elementIndex,
|
||||
int $elementCount,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue