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

[#897] Ending Soon Email Modifications #916

Merged
merged 7 commits into from
Apr 17, 2024
Merged

Conversation

bd-viget
Copy link
Contributor

@bd-viget bd-viget commented Apr 17, 2024

Summary

This PR makes some adjustments to how Auctions Ending Soon are determined.

Issues

Testing Instructions

  1. Wait until an Auction reaches 1/3 of the extension window before it ends
  2. Ending Soon Emails should be triggered to Bidders and Watchers.

For some reason, I was not getting the Bid Extension return value, so I added a fallback just in case.

@bd-viget bd-viget marked this pull request as ready for review April 17, 2024 22:17
Copy link
Contributor

@jaspercroome jaspercroome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thanks for cleaning this up! A few questions, no blockers. 🚀

}

// Set threshold to be 1/3 of bid extension window.
$threshold = intval( round( $extension * .3 ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥

*
* @return array
*/
public function get_auctions_ending_soon_emails(): array {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much cleaner, thanks for smashing this down into one function. Late Night Jasper is not one for brevity.

add_filter(
'cron_schedules', // phpcs:ignore
function ( array $schedules ): array {
foreach ( $this->cron_intervals as $id => $props ) {
// If one is already set, confirm it matches our schedule.
if ( ! empty( $schedules[ $props['name'] ] ) ) {
if ( MINUTE_IN_SECONDS === $schedules[ $props['name'] ] ) {
if ( $props['interval'] === $schedules[ $props['name'] ] ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this line what I was missing in getting the schedule added to the cron events?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the method was originally set up to only add 1 schedule, and when it was updated, the logic on this line was left to compare it just for the every minute schedule. This updates it so it compares the current schedule with the existing one. The other method was just a duplicate, but checked for a different interval value, so I just removed it.

@bd-viget
Copy link
Contributor Author

@jaspercroome I went ahead and added the Auction Extended hook, and moved the Auctioneer Event into that class.
See Commit

@bd-viget bd-viget merged commit b675aef into main Apr 17, 2024
1 check passed
@bd-viget bd-viget deleted the bd/897-ending-soon-email-stuff branch April 17, 2024 22:32
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

Successfully merging this pull request may close these issues.

2 participants