Commit 9c6c66b3 authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Merge branch '60-add-duration-to-schedule-end-date' into 'master'

Resolve "Add duration to schedule end date"

Closes #60

See merge request !48
parents 0193b072 19b84376
Pipeline #8944 passed with stages
in 2 minutes and 56 seconds
......@@ -56,6 +56,10 @@ class ScheduleCreate implements ScheduleCreateUseCase
try {
$this->rset->parse($attributes['rset']);
$end = $this->rset->endDate();
if ($end) {
$end->addRealMilliseconds($attributes['duration']);
}
$schedule = new Schedule(
0,
$attributes['group_id'],
......@@ -64,7 +68,7 @@ class ScheduleCreate implements ScheduleCreateUseCase
$attributes['duration'],
$attributes['description'],
$this->rset->beginDate() ?? Carbon::now(),
$this->rset->endDate()
$end
);
if (!$response->hasError()) {
......
......@@ -64,6 +64,10 @@ class ScheduleUpdate implements ScheduleUpdateUseCase
try {
$this->rset->parse($rset);
$end = $this->rset->endDate();
if ($end) {
$end->addRealMilliseconds($duration);
}
$schedule = new Schedule(
0,
$groupId,
......@@ -72,7 +76,7 @@ class ScheduleUpdate implements ScheduleUpdateUseCase
$duration,
$description,
$this->rset->beginDate() ?? Carbon::now(),
$this->rset->endDate(),
$end
);
if (!$response->hasError()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment