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

Clear order promotions in Omnes event #5754

Merged
merged 4 commits into from
May 23, 2024

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented May 16, 2024

Summary

This moves clearing the connected order promotions upon emptying an order into an Omnes::Subscriber. This saves us from having to override Spree::Order#empty! in the solidus_legacy_promotions gem.

Checklist

The following are mandatory for all PRs:

@mamhoff mamhoff requested a review from a team as a code owner May 16, 2024 15:33
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:repository Changes to the repository not within any gem labels May 16, 2024
@mamhoff mamhoff force-pushed the clear-order-promotions-in-omnes-event branch 2 times, most recently from deb6741 to 3b3877e Compare May 16, 2024 15:35
@mamhoff mamhoff changed the title Clear order promotions in omnes event Clear order promotions in Omnes event May 16, 2024
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.88%. Comparing base (098260d) to head (914d1aa).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5754   +/-   ##
=======================================
  Coverage   88.87%   88.88%           
=======================================
  Files         708      709    +1     
  Lines       16825    16835   +10     
=======================================
+ Hits        14953    14963   +10     
  Misses       1872     1872           

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

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.

Nice pattern, that we should use more often

This adds a subscriber that removes all connected order promotions upon
emptying the order. A future commit will emit the event instead of
directly removing the join table records.
@mamhoff mamhoff force-pushed the clear-order-promotions-in-omnes-event branch from 3b3877e to 914d1aa Compare May 22, 2024 09:47
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the way to go! Thanks again Martin!

core/app/models/spree/order.rb Show resolved Hide resolved
@tvdeyen tvdeyen merged commit 4e1a70d into solidusio:main May 23, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:repository Changes to the repository not within any gem 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