Fix setting next_at date for dynamics items, when the item hasnt been sent in the last run
This commit is contained in:
parent
2458ca2408
commit
9bc880520f
@ -3,6 +3,7 @@
|
||||
namespace App\Classes\File\Send;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\File\Send;
|
||||
use App\Classes\Node;
|
||||
@ -56,6 +57,8 @@ final class Dynamic extends Send
|
||||
|
||||
public function close(bool $successful,Node $node): void
|
||||
{
|
||||
Log::debug(sprintf('%s:- Close [%s] - %s',self::LOGKEY,$this->nameas,$successful ? 'SUCCESSFUL' : 'FAILED'));
|
||||
|
||||
if ($successful) {
|
||||
$this->complete = TRUE;
|
||||
|
||||
@ -75,7 +78,7 @@ final class Dynamic extends Send
|
||||
->addDay();
|
||||
|
||||
while ($this->do->next_at->isPast())
|
||||
$this->do->next_at->addDay();
|
||||
$this->do->next_at = $this->do->next_at->addDay();
|
||||
|
||||
break;
|
||||
|
||||
@ -84,7 +87,7 @@ final class Dynamic extends Send
|
||||
->addWeek();
|
||||
|
||||
while ($this->do->next_at->isPast())
|
||||
$this->do->next_at->addWeek();
|
||||
$this->do->next_at = $this->do->next_at->addWeek();
|
||||
|
||||
break;
|
||||
|
||||
@ -93,7 +96,7 @@ final class Dynamic extends Send
|
||||
->addMonth();
|
||||
|
||||
while ($this->do->next_at->isPast())
|
||||
$this->do->next_at->addMonth();
|
||||
$this->do->next_at = $this->do->next_at->addMonth();
|
||||
|
||||
break;
|
||||
|
||||
@ -101,6 +104,8 @@ final class Dynamic extends Send
|
||||
throw new \Exception(sprintf('%s:! Unknown frequency [%s] for [%d]',self::LOGKEY,$this->do->frequency,$this->do->id));
|
||||
}
|
||||
|
||||
Log::debug(sprintf('%s: - Frequency [%s], UPDATE next_at [%s]',self::LOGKEY,$this->do->frequency,$next_at->format('Y-m-d H:i:s')));
|
||||
|
||||
$this->do->save();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user