Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay in minutes is not working #2564

Open
dstollie opened this issue Oct 28, 2022 · 3 comments
Open

Delay in minutes is not working #2564

dstollie opened this issue Oct 28, 2022 · 3 comments

Comments

@dstollie
Copy link

dstollie commented Oct 28, 2022

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
Copy link
Author

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 added a commit to zonneplan/laravel-mailator that referenced this issue Oct 30, 2022
@dstollie
Copy link
Author

dstollie added a commit to zonneplan/laravel-mailator that referenced this issue Oct 31, 2022
dstollie added a commit to zonneplan/laravel-mailator that referenced this issue Oct 31, 2022
@binaryk
Copy link
Contributor

binaryk commented Feb 22, 2024

Thanks @dstollie , any progress with that one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants