-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Extract Legacy Promotion System: Move ActiveRecord Models and Factories #5634
Conversation
bcaff25
to
be37df1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5634 +/- ##
==========================================
+ Coverage 88.92% 88.94% +0.01%
==========================================
Files 719 724 +5
Lines 16944 16974 +30
==========================================
+ Hits 15068 15097 +29
- Misses 1876 1877 +1 ☔ View full report in Codecov by Sentry. |
We want to be able to move all promotion-related things out of `solidus_core` in PR solidusio#5634. However, Spree::AppConfiguration also does all the promotion-specific things, and we can't move the app configuration out of core. So what this does is it introduces a new configuration object containing those attributes of the core app_configuration class and moves them into a `promotion_configuration` object. This object is now available as Spree::Promotion::Config.
Depends on #5635 |
Thanks for your work on this @mamhoff. Now to find time to actually review it properly... 😅 |
…ration We want to be able to move all promotion-related things out of `solidus_core` in PR solidusio#5634. However, Spree::AppConfiguration also does all the promotion-specific things, and we can't move the app configuration out of core. In solidusio#5658, we've added a promotion configuration object as a nucleus for core's promotion system's configuration, `Spree::Core::PromotionConfiguration`. This implements all the promotion-specific configuration preferences from `Spree::AppConfiguration` there.
…ration We want to be able to move all promotion-related things out of `solidus_core` in PR solidusio#5634. However, Spree::AppConfiguration also does all the promotion-specific things, and we can't move the app configuration out of core. In solidusio#5658, we've added a promotion configuration object as a nucleus for core's promotion system's configuration, `Spree::Core::PromotionConfiguration`. This implements all the promotion-specific configuration preferences from `Spree::AppConfiguration` there.
…ration We want to be able to move all promotion-related things out of `solidus_core` in PR solidusio#5634. However, Spree::AppConfiguration also does all the promotion-specific things, and we can't move the app configuration out of core. In solidusio#5658, we've added a promotion configuration object as a nucleus for core's promotion system's configuration, `Spree::Core::PromotionConfiguration`. This implements all the promotion-specific configuration preferences from `Spree::AppConfiguration` there.
f57fc58
to
ba90efe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 I admire your patience
Awesome work.
legacy_promotions/db/migrate/20231031175215_add_promotion_order_promotion_foreign_key.rb
Outdated
Show resolved
Hide resolved
legacy_promotions/spec/mailers/spree/promotion_code_batch_mailer_spec.rb
Outdated
Show resolved
Hide resolved
legacy_promotions/db/migrate/20160101010001_solidus_one_four_promotions.rb
Outdated
Show resolved
Hide resolved
legacy_promotions/db/migrate/20161017102621_create_spree_promotion_code_batch.rb
Outdated
Show resolved
Hide resolved
legacy_promotions/app/decorators/solidus_legacy_promotions/models/spree/order_decorator.rb
Outdated
Show resolved
Hide resolved
14d959e
to
679f6b6
Compare
8b1a5f9
to
4525f8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOW. 👏🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the commitment on this @mamhoff! I left a comment about changing the migration's Rails versions, which I think might cause issues in the future. Please, let me know your thoughts.
legacy_promotions/db/migrate/20160101010001_solidus_one_four_promotions.rb
Outdated
Show resolved
Hide resolved
800900b
to
3a194ce
Compare
`Spree::PromotionAction` is not in core any longer, and the null promo adjuster can not actually produce any adjustments.
3a194ce
to
2c2e371
Compare
Since these promotions will be installed into all stores, we need to make sure they don't do anything to the existing promotion system. For new stores, they must do the things though.
We need to purge references to Solidus' legacy promotion system from the core.
Except for the flat rate calculator, as that one is so generic it's often just used as a stand-in calculator.
In legacy_promotions, we'll just keep them in `app`, where they're tested, too.
We don't need #recalculate for anything in core, and we don´t need the association to promotion codes.
I'm keeping the spec to test what the model does, but moving the extended spec with the actual promotion to solidus_legacy_promotions.
2c2e371
to
ee5a91d
Compare
This should help everyones test suite's to stay green.
ee5a91d
to
a78e28d
Compare
@kennyadsl are we ready to go? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stellar work, thanks @mamhoff!
Summary
This extracts the legacy promotion system into a gem that lives within the solidus codebase. I've talked about this with @kennyadsl as a way to integrate a new solidus_promotions gem later, modeled after solidus_friendly_promotions.
This is the final piece of the extraction process, after many merged PRs. Thank you to @kennyadsl , @elia , @jarednorman , @adammathys and @tvdeyen for many reviews. This is the final one, after that we'll have managed to extract all of the promotion system into
solidus_legacy_promotions
.In this PR, we move the ActiveRecord models and specs that are part of the legacy promotion system into
solidus_legacy_promotions
.Checklist
The following are mandatory for all PRs: