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

WIP Extract legacy promotions #5634

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jan 27, 2024

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:

  • 📖 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 January 27, 2024 15:00
@github-actions github-actions bot added changelog:solidus_api Changes to the solidus_api gem changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem changelog:solidus Changes to the solidus meta-gem changelog:repository Changes to the repository not within any gem changelog:solidus_admin labels Jan 27, 2024
@mamhoff mamhoff force-pushed the extract-legacy-promotions branch 2 times, most recently from bcaff25 to be37df1 Compare January 27, 2024 16:10
Copy link

codecov bot commented Jan 27, 2024

Codecov Report

Attention: Patch coverage is 97.56098% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 88.81%. Comparing base (d5dd8b6) to head (48f1a68).

❗ Current head 48f1a68 differs from pull request most recent head 5bebaa5. Consider uploading reports for the commit 5bebaa5 to get more accurate results

Files Patch % Lines
...otions/migrations/promotions_with_code_handlers.rb 0.00% 3 Missing ⚠️
...gacy_promotions/app/models/spree/order_contents.rb 95.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

mamhoff added a commit to mamhoff/solidus that referenced this pull request Jan 29, 2024
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.
@mamhoff mamhoff mentioned this pull request Jan 29, 2024
3 tasks
@mamhoff
Copy link
Contributor Author

mamhoff commented Jan 29, 2024

Depends on #5635

@jarednorman
Copy link
Member

Thanks for your work on this @mamhoff. Now to find time to actually review it properly... 😅

@mamhoff mamhoff marked this pull request as draft February 3, 2024 12:09
mamhoff added a commit to mamhoff/solidus that referenced this pull request Feb 17, 2024
…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.
mamhoff added a commit to mamhoff/solidus that referenced this pull request Feb 18, 2024
…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.
spaghetticode pushed a commit to nebulab/solidus that referenced this pull request Feb 26, 2024
…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.
@mamhoff mamhoff force-pushed the extract-legacy-promotions branch 2 times, most recently from f57fc58 to ba90efe Compare February 27, 2024 12:57
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.

😅 I admire your patience

Awesome work.

@mamhoff mamhoff force-pushed the extract-legacy-promotions branch 2 times, most recently from 14d959e to 679f6b6 Compare February 28, 2024 08:18
@mamhoff mamhoff force-pushed the extract-legacy-promotions branch 2 times, most recently from 8b1a5f9 to 4525f8b Compare February 29, 2024 11:44
@github-actions github-actions bot removed the changelog:solidus Changes to the solidus meta-gem label Mar 6, 2024
@github-actions github-actions bot removed the changelog:solidus_api Changes to the solidus_api gem label Mar 12, 2024
mamhoff added 21 commits June 4, 2024 13:49
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.
@mamhoff mamhoff force-pushed the extract-legacy-promotions branch from ab26519 to 6543171 Compare June 4, 2024 11:59
@github-actions github-actions bot removed changelog:solidus_backend Changes to the solidus_backend gem changelog:repository Changes to the repository not within any gem changelog:solidus_admin labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants