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

Move adjustment promotion code id to legacy promotions #5800

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jun 22, 2024

Summary

Historically, adjustments did not know about their promotion code ID, and solidus_friendly_promotions joins over the friendly_order_promotions join table instead. This column is part of the legacy promotion system.

This had some copy-pasta, and the requiring the engine requires
requiring the gem first.
SolidusFriendlyPromotions does not store promotion code IDs on
adjustments, and it does not need to: The promotion code is stored on
the `friendly_order_promotions` join table between promotion and order,
and adjustments and promotion codes can be joined between that table and
the adjustments' source.

This fixes the build on solidus_friendly_promotions currently, because
what that gem does it simply make `require_promotion_code` return
`false` for adjustments created with the new promotion system. This
change makes the validation self-contained for adjustments from the
`legacy_promotions` gem.
It's always set to nil, so it doesn't matter for the specs in question,
and we can just not specify it.
If `solidus_legacy_promotions` is loaded, we can be sure that the column
exists.
This moves the column into solidus_legacy_promotions, which is the only
place it's used at.
@mamhoff mamhoff requested a review from a team as a code owner June 22, 2024 08:43
@github-actions github-actions bot added changelog:solidus_api Changes to the solidus_api gem changelog:solidus_core Changes to the solidus_core gem changelog:solidus_admin labels Jun 22, 2024
Copy link

codecov bot commented Jun 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.78%. Comparing base (66aba5b) to head (91ba272).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5800   +/-   ##
=======================================
  Coverage   88.78%   88.78%           
=======================================
  Files         731      731           
  Lines       17053    17057    +4     
=======================================
+ Hits        15140    15144    +4     
  Misses       1913     1913           

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

@tvdeyen tvdeyen merged commit f618eb3 into solidusio:main Jun 24, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_admin changelog:solidus_api Changes to the solidus_api gem changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants