-
-
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
WIP Extract legacy promotions #5634
base: main
Are you sure you want to change the base?
Conversation
bcaff25
to
be37df1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5634 +/- ##
==========================================
- Coverage 88.87% 88.81% -0.07%
==========================================
Files 699 705 +6
Lines 16607 16660 +53
==========================================
+ Hits 14760 14797 +37
- Misses 1847 1863 +16 ☔ 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
5bebaa5
to
ab26519
Compare
This also tells us we need to set the migration version to Rails 6.1, in which the if_exists/if_not_exists options were introduced.
We need to purge references to Solidus' legacy promotion system from the core.
In legacy_promotions, we'll just keep them in `app`, where they're tested, too.
Spree::Calculator::FlatRate is gone, but luckily, we can just use the shipping equivalent.
We don't need #recalculate for anything in core, and we don´t need the association to promotion codes.
We don't actually have any promotion code in core left, so we need to be using the Null promotion configuration.
I'm keeping the spec to test what the model does, but moving the extended spec with the actual promotion to solidus_legacy_promotions.
`Spree::PromotionAction` is not in core any longer, and the null promo adjuster can not actually produce any adjustments.
ab26519
to
6543171
Compare
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 still Work in progress, and comments are welcome.
Checklist
The following are mandatory for all PRs:
The following are not always needed: