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

Add "Hourly" as a default interval #20

Merged
merged 12 commits into from
Apr 27, 2020
Merged

Conversation

stevegrunwell
Copy link
Contributor

@stevegrunwell stevegrunwell commented Apr 27, 2020

This PR adds support for "hourly" as a default interval, meaning the order limiting would reset at the top of every hour.

Since this change introduces sub-day resetting, I've also applied some updates to the messaging within WP Admin (e.g. "Based on your store's configuration, new orders have been put on hold until 4:00pm" instead of always defaulting to the date on which the next interval begins).

The customer-facing placeholders have also been updated, giving store owners the following options:

  • {current_interval} (e.g. "April 27, 2020")
  • {current_interval:date} (alias of {current_interval})
  • {current_interval:time}(e.g. "5:00pm")
  • {next_interval} (e.g. "April 28, 2020")
  • {next_interval:date} (alias of {next_interval})
  • {next_interval:time}(e.g. "6:00pm")
  • {limit} (e.g. "100")

I've kept {current_interval} and {next_interval} for backwards-compatibility purposes.

Fixes #18.

A message like "Based on your store's configuration, new orders have been put on hold until April 27, 2020" isn't very useful if it's already 2020-04-27 but orders are just turned off until the top of the next hour.

The new rules for the admin messaging are:

1. If the next interval starts sometime today, show the [local] time it will begin (hourly)
2. If it restarts at midnight, explicitly say "midnight" (hourly, daily)
3. Otherwise, show the date (weekly, monthly)
@stevegrunwell stevegrunwell added the enhancement New feature or request label Apr 27, 2020
@stevegrunwell stevegrunwell added this to the Version 1.2.0 milestone Apr 27, 2020
@stevegrunwell stevegrunwell requested a review from bswatson April 27, 2020 18:46
@stevegrunwell stevegrunwell changed the title WIP: Add "Hourly" as a default interval Add "Hourly" as a default interval Apr 27, 2020
@stevegrunwell
Copy link
Contributor Author

Just realized the README hasn't been updated with the new placeholders, adding now.

@bswatson
Copy link
Contributor

Waiting to merge until the readme is updated

@bswatson bswatson merged commit ef691d5 into develop Apr 27, 2020
@bswatson bswatson deleted the feature/hourly-interval branch April 27, 2020 19:06
@stevegrunwell stevegrunwell mentioned this pull request Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hourly interval
2 participants