nodes are scheduled on different days according to dates provided
This commit is contained in:
parent
858f2e075f
commit
358694e7e3
3 changed files with 58 additions and 2 deletions
|
|
@ -74,10 +74,21 @@ class CreatePlan
|
|||
name: $request->name,
|
||||
user: $user,
|
||||
));
|
||||
foreach ($nodesOfText as $node) {
|
||||
|
||||
$dates = [];
|
||||
$currentDate = $startDate;
|
||||
while ($currentDate <= $endDate) {
|
||||
$dates[] = $currentDate;
|
||||
$currentDate = $currentDate->modify('+1 day');
|
||||
}
|
||||
|
||||
foreach ($nodesOfText as $index => $node) {
|
||||
$dateIndex = $index % count($dates);
|
||||
$scheduledDate = $dates[$dateIndex];
|
||||
|
||||
$this->createScheduledNode->execute(
|
||||
new CreateScheduledNodeRequest(
|
||||
date: '2025-01-01', // TODO: this should be cycling over some list of dates
|
||||
date: $scheduledDate->format('Y-m-d'),
|
||||
planId: $plan->getId(),
|
||||
)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue