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

Rename currently_valid to prioritized_for_default #4109

Conversation

waiting-for-dev
Copy link
Contributor

Description

It conveys better what it's doing, as the query only consists of ORDER
clauses and no record is filtered out.

Extracted from #3994

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 (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

It conveys better what it's doing, as the query only consists of `ORDER`
clauses and no record is filtered out.
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Nice, but I think we need some deprecations here.

@@ -17,8 +17,8 @@ def self.default_price_attributes
# Returns `#prices` prioritized for being considered as default price
#
# @return [ActiveRecord::Relation<Spree::Price>]
def currently_valid_prices
Copy link
Member

Choose a reason for hiding this comment

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

I think we should deprecate this method instead of removing it.

@@ -20,7 +20,7 @@ class Price < Spree::Base
validates :currency, inclusion: { in: ::Money::Currency.all.map(&:iso_code), message: :invalid_code }
validates :country, presence: true, unless: -> { for_any_country? }

scope :currently_valid, -> { order(Arel.sql("country_iso IS NULL")).order(updated_at: :DESC, id: :DESC) }
Copy link
Member

Choose a reason for hiding this comment

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

Let's deprecate this as well!

@kennyadsl kennyadsl added the changelog:solidus_core Changes to the solidus_core gem label Jun 21, 2021
@waiting-for-dev
Copy link
Contributor Author

We're closing it as we'll be revisiting this stuff in the context of services objects.

@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/rename_currently_valid_to_priorititzed_for_default branch September 4, 2023 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants