laravel-mailator icon indicating copy to clipboard operation
laravel-mailator copied to clipboard

Delay in minutes is not working

Open dstollie opened this issue 3 years ago • 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;

dstollie avatar Oct 28 '22 16:10 dstollie

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%");
  }

This is a screeny from the contents Screenshot 2022-10-28 at 20 59 54

dstollie avatar Oct 28 '22 19:10 dstollie

Wip in this fork: https://github.com/zonneplan/laravel-mailator/commits/master

dstollie avatar Oct 30 '22 16:10 dstollie

Thanks @dstollie , any progress with that one?

binaryk avatar Feb 22 '24 10:02 binaryk