Skip to content

Conversation

@manleyac
Copy link
Contributor

@manleyac manleyac commented May 12, 2025

Summary

This fixes a bug being unable to create a line_item_option_value condition. Adding a line_item_option_value as a condition to a benefit will raise a TypeError due to the form submitting an array when a hash is expected.

Currently, the product-picker allows for selecting multiple products when only one product should be selected per entry. The selected product id is not passed to the option-value-picker resulting in the params being malformed and the conditions_controller raising a 500 on create.

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.

@manleyac manleyac requested a review from a team as a code owner May 12, 2025 19:00
@github-actions github-actions bot added the changelog:solidus_promotions Changes to the solidus_promotions gem label May 12, 2025
@codecov
Copy link

codecov bot commented May 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.44%. Comparing base (143f09a) to head (b0eda8b).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6233   +/-   ##
=======================================
  Coverage   89.44%   89.44%           
=======================================
  Files         973      973           
  Lines       20298    20298           
=======================================
  Hits        18156    18156           
  Misses       2142     2142           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks. Would you mind to add some specs? This should have been caught by specs in the first place.

@manleyac manleyac marked this pull request as draft May 14, 2025 15:54
@manleyac manleyac force-pushed the fix-line-item-option-condition-params branch from 86bdfdb to 674cbcc Compare May 14, 2025 15:54
@mamhoff mamhoff force-pushed the fix-line-item-option-condition-params branch from 674cbcc to 25285b3 Compare November 3, 2025 17:37
@mamhoff mamhoff force-pushed the fix-line-item-option-condition-params branch 2 times, most recently from 86edf8a to 9bb6e94 Compare November 17, 2025 13:09
manleyac and others added 4 commits November 17, 2025 22:43
This updates the product picker for the line_item_option_value form
to not allow selecting multiple products per entry.
This fixes an issue where the option-value-picker was not
receiving the id for the selected product. Therefore the correct
option values where not available and the params where malformed.
When creating an option value condition, we only want to have option
values that fit the product in question. This commit makes it such that
the option value picker re-initializes when the selected product
changes.
@mamhoff mamhoff force-pushed the fix-line-item-option-condition-params branch from 9bb6e94 to b0eda8b Compare November 17, 2025 21:43
@mamhoff mamhoff marked this pull request as ready for review November 18, 2025 07:48
@mamhoff mamhoff added backport-v4.5 Backport this pull-request to v4.5 backport-v4.6 Backport this pull-request to v4.6 labels Nov 18, 2025
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks. Tested manually. Worth a back port, since this is an actual bug in a released version

@tvdeyen tvdeyen merged commit 2768bad into solidusio:main Nov 19, 2025
43 checks passed
@solidus-bot
Copy link

solidus-bot bot commented Nov 19, 2025

💔 All backports failed

Status Branch Result
v4.5 Backport failed because of merge conflicts
v4.6 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

backport --pr 6233

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v4.5 Backport this pull-request to v4.5 backport-v4.6 Backport this pull-request to v4.6 changelog:solidus_promotions Changes to the solidus_promotions gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants