-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 discontinue on to products #3793
Add discontinue on to products #3793
Conversation
core/db/migrate/20201008213609_add_discontinue_on_to_spree_products.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tvdeyen thanks for the new feature, it looks good but there's a comment that needs a small change.
@kennyadsl @aldesantis there are lots of failing specs that don't seem to be related to this PR. Do I need to do something or do we have CI issues? |
36784ff
to
b1421e2
Compare
Products have an available on timestamp, but no discontinue on date. For actual timebased publishing we should have one. The name of the attribute has been chosen to be compatible with stores migrating from Spree >= 3.1
Like with the available on date we want to be able to set the discontinue on date as well.
b1421e2
to
69690e0
Compare
A convenient predicate method to check the discontinued state of a product.
5eb32ec
to
d5a7dc4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, definitely a good change because I know I'm going to have remove the custom discontinued tracking from multiple existing stores and switch to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tvdeyen thanks for this neat new feature ❤️
😍 Thanks @tvdeyen! |
Description
Adds a
discontinue_on
attribute to products. This accompanies theavailable_on
attribute to complete the "Time Based Availability" feature. TheProduct.available
scope andProduct#avaliable?
method take this new date filed into account to calculate the availability of products.Refs #465
Note
Contrary to the suggestions in #465 I used the
discontinue_on
attribute introduced in Spree 3.1 for compatibility reasons. If we think this is a mistake we can also rename the attribute, but this will make migrations for former Spree users harder.Checklist: