-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Build discounted linte items in memory #6385
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
Build discounted linte items in memory #6385
Conversation
Instead of destroying. See code comments and spec changes. This is similar to how we handled this in the legacy promotion system. Co-authored-by: Adam Mueller <adam@super.gd> Co-authored-by: Alistair Norman <alistair@super.gd> Co-authored-by: An Stewart <andrew@super.gd> Co-authored-by: benjamin wil <benjamin@super.gd> Co-authored-by: Harmony Evangelina <harmony@super.gd> Co-authored-by: Jared Norman <jared@super.gd> Co-authored-by: Nick Van Doorn <nick@super.gd> Co-authored-by: Senem Soy <senem@super.gd> Co-authored-by: Sofia Besenski <sofia@super.gd>
When computing item totals after a line item benefit is removed, we need to ensure we aren't using the marked for destruction items. We also needed to make a change to the legacy promotion order updater patch because it is incorrectly being used in our tests even when using the new promotion system. It also did not have logic to ensure adjustments that were marked for destruction were ignored in the adjustment totals calculation. Co-authored-by: Jared Norman <jared@super.gd> Co-authored-by: Noah Silvera <noah@super.gd> Co-authored-by: Alistair Norman <alistair@super.gd>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6385 +/- ##
=======================================
Coverage 89.45% 89.45%
=======================================
Files 974 974
Lines 20322 20323 +1
=======================================
+ Hits 18179 18180 +1
Misses 2143 2143 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f6444c3 to
91f7ddd
Compare
As part of the work to move towards reducing database writes, this change attempts to build discounted item benefits in-memory and allow the order updater to recalculate their totals correctly. Co-authored-by: Adam Mueller <adam@super.gd> Co-authored-by: Alistair Norman <alistair@super.gd> Co-authored-by: Andrew Stewart <andrew@super.gd> Co-authored-by: benjamin wil<benjamin@super.gd> Co-authored-by: Chris Todorov <chris@super.gd> Co-authored-by: Harmony Bouvier <harmony@super.gd> Co-authored-by: Jared Norman <jared@super.gd> Co-authored-by: Nick Van Doorn <nick@super.gd> Co-authored-by: Noah Silvera <noah@super.gd> Co-authored-by: Senem Soy <senem@super.gd> Co-authored-by: Sofia Besenski <sofia@super.gd>
In an associated change we made the `CreateDiscountedItem` benefit create in-memory line items. That causes an issue during the recalculation of the item totals. Co-authored-by: benjamin wil <benjamin@super.gd> Co-authored-by: Kendra Riga <kendra@super.gd> Co-authored-by: Noah Silvera <noah@super.gd> Co-authored-by: Jared Norman <jared@super.gd> Co-authored-by: Alistair Norman <alistair@super.gd>
We want to make sure we don't persist anything when computing amounts becuase that will cause issues with the in-memory order updater.
91f7ddd to
64ecee0
Compare
mamhoff
left a comment
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 do have a suggestion for the PR title: |
spaghetticode
left a comment
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.
👏
tvdeyen
left a comment
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.
Amazing mob programming work 👏🏻
Summary
This change builds on the work in #6382 and depends on that to work correctly. The first two commits here are from #6382 and will be rebased out once that has been merged.
These were extracted from #5872 to make that PR smaller and easier to review.
This change refactors how we build discounted items and allows the order updater
to correctly update their totals.
This change also adds some test coverage and assertions for the legacy promotion system to ensure we don't introduce unnecessary writes to the database in the future.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: