Skip to content

Rename currently_valid to prioritized_for_default#4109

Closed
waiting-for-dev wants to merge 1 commit intosolidusio:masterfrom
nebulab:waiting-for-dev/rename_currently_valid_to_priorititzed_for_default
Closed

Rename currently_valid to prioritized_for_default#4109
waiting-for-dev wants to merge 1 commit intosolidusio:masterfrom
nebulab:waiting-for-dev/rename_currently_valid_to_priorititzed_for_default

Conversation

@waiting-for-dev
Copy link
Copy Markdown
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
Copy Markdown
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.

# Returns `#prices` prioritized for being considered as default price
#
# @return [ActiveRecord::Relation<Spree::Price>]
def currently_valid_prices
Copy link
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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