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 discontinue on to products #3793

Merged
merged 4 commits into from
Oct 13, 2020

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Oct 8, 2020

Description

Adds a discontinue_on attribute to products. This accompanies the available_on attribute to complete the "Time Based Availability" feature. The Product.available scope and Product#avaliable? method take this new date filed into account to calculate the availability of products.

Refs #465

Monosnap 2020-10-09 12-55-16

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:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change
  • I have added tests to cover this change
  • I have attached screenshots to this PR for visual changes

Copy link
Member

@spaghetticode spaghetticode left a 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.

core/app/models/spree/product.rb Outdated Show resolved Hide resolved
@tvdeyen
Copy link
Member Author

tvdeyen commented Oct 9, 2020

@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?

@tvdeyen tvdeyen force-pushed the add-discontinue_on-to-products branch from 36784ff to b1421e2 Compare October 9, 2020 10:52
@tvdeyen tvdeyen marked this pull request as ready for review October 9, 2020 11:00
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.
@tvdeyen tvdeyen force-pushed the add-discontinue_on-to-products branch from b1421e2 to 69690e0 Compare October 9, 2020 20:55
@tvdeyen tvdeyen requested a review from spaghetticode October 9, 2020 21:19
A convenient predicate method to check the discontinued state of a product.
@tvdeyen tvdeyen force-pushed the add-discontinue_on-to-products branch from 5eb32ec to d5a7dc4 Compare October 9, 2020 21:22
Copy link
Member

@jarednorman jarednorman left a 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.

Copy link
Member

@spaghetticode spaghetticode left a 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 ❤️

@aldesantis
Copy link
Member

😍 Thanks @tvdeyen!

@aldesantis aldesantis merged commit be6b804 into solidusio:master Oct 13, 2020
@tvdeyen tvdeyen deleted the add-discontinue_on-to-products branch October 13, 2020 14:33
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.

5 participants