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

Update Spree::Product scopes.rb to fix issue with 'descend_by_popularity' scope #4969

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

cmbaldwin
Copy link
Contributor

Fixes issue "'disallow_raw_sql!': Query method called with non-attribute argument" for the Spree::Product scope 'descend_by_popularity'. Uses the Arel.sql method to build sanitized SQL.

Fixes #4968

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@cmbaldwin cmbaldwin requested a review from a team as a code owner March 8, 2023 01:54
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Mar 8, 2023
@cmbaldwin cmbaldwin changed the title Update scopes.rb Update Spree::Product scopes.rb to fix issue with 'descend_by_popularity' scope Mar 8, 2023
@waiting-for-dev
Copy link
Contributor

Thanks, @cmbaldwin 🙌 Would you mind adding a regression test for that? 🙏

Fixes issue with 'disallow_raw_sql!': Query method called with non-attribute argument we need to use build in Arel.sql method

Regression test for descend_by_popularity
@cmbaldwin
Copy link
Contributor Author

cmbaldwin commented Mar 9, 2023

Thanks, @cmbaldwin 🙌 Would you mind adding a regression test for that? 🙏

I'm a novice at this, like I'm just learning rspec, is this acceptable?

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.

Thanks!

Copy link
Contributor

@waiting-for-dev waiting-for-dev left a comment

Choose a reason for hiding this comment

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

Thanks!!!

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Merging #4969 (1f45cdd) into master (c09ead3) will decrease coverage by 0.79%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4969      +/-   ##
==========================================
- Coverage   86.69%   85.91%   -0.79%     
==========================================
  Files         578      531      -47     
  Lines       14685    13183    -1502     
==========================================
- Hits        12731    11326    -1405     
+ Misses       1954     1857      -97     
Impacted Files Coverage Δ
core/app/models/spree/product/scopes.rb 63.80% <ø> (+0.95%) ⬆️
api/app/controllers/spree/api/states_controller.rb
.../app/controllers/spree/api/countries_controller.rb
...app/controllers/spree/api/line_items_controller.rb
api/lib/spree/api/responders/jbuilder_template.rb
api/lib/spree/api/config.rb
...ntrollers/spree/api/customer_returns_controller.rb
.../controllers/spree/api/option_values_controller.rb
api/lib/spree/api/testing_support/setup.rb
...p/controllers/spree/api/credit_cards_controller.rb
... and 39 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@waiting-for-dev waiting-for-dev merged commit 039f4a7 into solidusio:master Mar 9, 2023
@cmbaldwin cmbaldwin deleted the patch-1 branch March 9, 2023 22:04
@kennyadsl
Copy link
Member

Just for reference, this PR is making the test suite fail pretty consistently: https://app.circleci.com/pipelines/github/solidusio/solidus/4165/workflows/08e29e14-a001-406a-a924-be5443af3cf1/jobs/39599.

@cmbaldwin Do you want to take a look at it?

@kennyadsl
Copy link
Member

@cmbaldwin I think I have a fix with #4979.

@cmbaldwin
Copy link
Contributor Author

cmbaldwin commented Mar 22, 2023

Thanks!

Sorry I was a bit busy with other things last week, didn't show up on my radar until just now.

I learned a bit from your fix, setting specific variables instead of 'let' and the create_list method. Cheers :)

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.

Query method called with non-attribute argument(s) Error
3 participants