Delay in minutes is not working
dstollie opened this issue · 3 comments
I Think that there is a bug where delay_minute is not working properly
In AfterConstraint.php
The below code at the end diffs the hours between the delay_minutes. I think the diff should be done in minutes.
//till ends we should have at least toDays days
return $schedule->isOnce()
? $schedule->timestamp_target->diffInHours(now()->floorSeconds()) === $schedule->delay_minutes
: $schedule->timestamp_target->diffInHours(now()->floorSeconds()) > $schedule->delay_minutes;
After working some more with this package I think I discovered an additional issue; In the AfterConstraint
the condition should always be >=
instead of >
. When you have an delay of 1 hour you expected i to sent after 1 hour instead of > 1 hour
r.48 AfterConstraint.php
: $schedule->timestamp_target->diffInHours(now()->floorSeconds()) > $schedule->delay_minutes;
Should be
: $schedule->timestamp_target->diffInMinutes(now()->floorSeconds()) >= $schedule->delay_minutes;
Additionaly after working more with this awesome package I think I found a bug in the unique()
method functionality. It seems that it does not working as expected
There seems to be going something wrong on the like statement when a "" is in the $class
This doesnt work
public function scopeMailableClass($query, $class)
{
$query->where('mailable_class', 'LIKE', "%Modules\EnergySubmission\Mail\IncompleteSubmissionMissingMeterSerialMailable%");
}
This neither
public function scopeMailableClass($query, $class)
{
$query->where('mailable_class', 'LIKE', "%\IncompleteSubmissionMissingMeterSerialMailable%");
}
This works
public function scopeMailableClass($query, $class)
{
$query->where('mailable_class', 'LIKE', "%IncompleteSubmissionMissingMeterSerialMailable%");
}
Wip in this fork: https://github.com/zonneplan/laravel-mailator/commits/master