Skip to content

Conversation

@mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Nov 21, 2025

Summary

This adds the PercentWithCap calculator to the list of available line item promotion calculators, and also fixes the default calculator fields partial to not try to send :humanize to a Symbol.

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.

@mamhoff mamhoff requested a review from a team as a code owner November 21, 2025 13:32
@github-actions github-actions bot added the changelog:solidus_promotions Changes to the solidus_promotions gem label Nov 21, 2025
@mamhoff mamhoff added the backport-v4.6 Backport this pull-request to v4.6 label Nov 21, 2025
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.46%. Comparing base (ea4bb50) to head (7e1de2d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6381   +/-   ##
=======================================
  Coverage   89.46%   89.46%           
=======================================
  Files         975      975           
  Lines       20335    20335           
=======================================
  Hits        18192    18192           
  Misses       2143     2143           

☔ 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.

Can we extract the fix from the added calculator? The partial fix can be back ported to 4.6, but the calculator is only present in main (4.7.0.dev) and cannot be ported.

@mamhoff
Copy link
Contributor Author

mamhoff commented Nov 22, 2025

Can we extract the fix from the added calculator? The partial fix can be back ported to 4.6, but the calculator is only present in main (4.7.0.dev) and cannot be ported.

The calculator is present in 4.6, and it's the only calculator that we ship that needs the fallback partial - that's why both commits are together, I can't really test the problem without the calculator.

Cf 09c3ec5

@tvdeyen
Copy link
Member

tvdeyen commented Nov 22, 2025

Can we extract the fix from the added calculator? The partial fix can be back ported to 4.6, but the calculator is only present in main (4.7.0.dev) and cannot be ported.

The calculator is present in 4.6, and it's the only calculator that we ship that needs the fallback partial - that's why both commits are together, I can't really test the problem without the calculator.

Cf 09c3ec5

Ah, I was was misreading 6b2f3df (which is only present in main). Apologies.

@tvdeyen
Copy link
Member

tvdeyen commented Nov 22, 2025

The PR title is doing a good job in confusing as well

Promotions: Add PercentWithCap calculator, fix default calculator fields partial bug

@mamhoff Can you rephrase this please?

@mamhoff mamhoff changed the title Promotions: Add PercentWithCap calculator, fix default calculator fields partial bug Promotions: Fix default calculator fields partial bug and make PercentWithCap calculator available in the UI Nov 22, 2025
@mamhoff
Copy link
Contributor Author

mamhoff commented Nov 22, 2025

The PR title is doing a good job in confusing as well

Promotions: Add PercentWithCap calculator, fix default calculator fields partial bug

@mamhoff Can you rephrase this please?

Done

We've added a promotion calculator, but we have not made it available to
users.
For all calculators except the `PercentWithCap` one we have a custom
`calculator_fields` partial. PercentWithCap does not need that - it can
fall back to the default calculator fields partial. However, that
partial does not render currently, because `name` is a symbol that does
not respond to `humanize`.

Adds a system spec as well.
@tvdeyen tvdeyen force-pushed the fix-percent-with-cap-ui branch from 45c4e2a to 7e1de2d Compare November 26, 2025 06:58
@tvdeyen tvdeyen enabled auto-merge November 26, 2025 06:58
@tvdeyen tvdeyen merged commit d3ef74b into solidusio:main Nov 26, 2025
39 checks passed
@solidus-bot
Copy link

solidus-bot bot commented Nov 26, 2025

💔 All backports failed

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

You might need to backport the following PRs to v4.6:
- Fix appearance and specs for option value condition
- Promotions: Pass product-picker to option-value-picker

Manual backport

To create the backport manually run:

backport --pr 6381

Questions ?

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

@mamhoff
Copy link
Contributor Author

mamhoff commented Dec 5, 2025

💚 All backports created successfully

Status Branch Result
v4.6

Questions ?

Please refer to the Backport tool documentation

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

Labels

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.

3 participants