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

Alistair/in memory order updater #6026

Conversation

AlistairNorman
Copy link
Contributor

Summary

Checklist

Check out our PR guidelines for more details.

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.

benjaminwil and others added 16 commits November 8, 2024 14:34
https://github.com/sds/db-query-matchers

Co-authored-by: Adam Mueller <adam@super.gd>
Co-authored-by: Andrew Stewart <andrew@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: Noah Silvera <noah@super.gd>
Co-authored-by: Senem Soy <senem@super.gd>
Co-authored-by: Sofia Besenski <sofia@super.gd>
Co-authored-by: Tom Van Manen <tom@super.gd>
In subsequent commits we'll ensure that this can update orders in
memory, without persisting changes using manipulative DB queries.

Co-authored-by: Adam Mueller <adam@super.gd>
Co-authored-by: Andrew Stewart <andrew@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: Noah Silvera <noah@super.gd>
Co-authored-by: Senem Soy <senem@super.gd>
Co-authored-by: Sofia Besenski <sofia@super.gd>
Co-authored-by: Tom Van Manen <tom@super.gd>
We want our new in-memory order updater to be able to persist or not
persist changes to the order record.

WORK IN PROGRESS

This is a first step in ensuring we don't need to write to the database
using the order updater. Clearly we have more work to do to ensure this
functions like the existing updater.

Co-authored-by: Adam Mueller <adam@super.gd>
Co-authored-by: Andrew Stewart <andrew@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: Noah Silvera <noah@super.gd>
Co-authored-by: Senem Soy <senem@super.gd>
Co-authored-by: Sofia Besenski <sofia@super.gd>
Co-authored-by: Tom Van Manen <tom@super.gd>
This is in service of supporting the InMemoryOrderUpdater's goal to not do database writes.
…atabase writes

We have prevented write calls to update the cost and `updated_at` of a
shipment, as well as allowed us to conditionally persist item totals, by
passing down the `persist` argument to that method.

Co-authored-by: Adam Mueller <adam@super.gd>
Co-authored-by: Andrew Stewart <andrew@super.gd>
Co-authored-by: Harmony Evangelina <harmony@super.gd>
Co-authored-by: Kendra Riga <kendra@super.gd>
Co-authored-by: Jared Norman <jared@super.gd>
Co-authored-by: Tom Van Manen <tom@super.gd>
Co-authored-by: Chris Todorov <chris@super.gd>
Co-authored-by: Sofia Besenski <sofia@super.gd>
Co-authored-by: Senem Soy <senem@super.gd>
Co-authored-by: Benjamin Willems <benjamin@super.gd>
Update implies that we are persisting the change in Rails, which this
method does not do.

Co-authored-by: Adam Mueller <adam@super.gd>
Co-authored-by: Senem Soy <senem@super.gd>
Co-authored-by: Andrew Stewart <andrew@super.gd>
Co-authored-by: Kendra Riga <kendra@super.gd>
Co-authored-by: Sofia Besenski <sofia@super.gd>
Co-authored-by: Benjamin Willems <benjamin@super.gd>
Update implies that we are persisting the change in Rails, which this
method does not do.

Co-authored-by: Adam Mueller <adam@super.gd>
Co-authored-by: Andrew Stewart <andrew@super.gd>
Co-authored-by: Benjamin Willems <benjamin@super.gd>
Co-authored-by: Senem Soy <senem@super.gd>
Co-authored-by: Sofia Besenski <sofia@super.gd>
Co-authored-by: Kendra Riga <kendra@super.gd>
These methods don't persist so it's more accurate to say that they
recalculate the total instead of saying that they update it.

Co-Authored-By: Adam Mueller <adam@super.gd>
Co-Authored-By: Benjamin Willems <benjamin@super.gd>
Co-Authored-By: Andrew Stewart <andrew@super.gd>
Co-Authored-By: Harmony Bouvier <harmony@super.gd>
Co-Authored-By: Jared Norman <jared@super.gd>
Co-Authored-By: Kendra Riga <kendar@super.gd>
Co-Authored-By: Sofia Besenski <sofia@super.gd>
Co-Authored-By: Chris Todorov <chris@super.gd>
Co-Authored-By: Tom Van Manen <tom@super.gd>
Co-Authored-By: Noah Silvera <noah@super.gd>
We want all the methods that might persist data to be called update_
instead of recalculate to be clear that they hit the database.

Co-Authored-By: Adam Mueller <adam@super.gd>
Co-Authored-By: Benjamin Willems <benjamin@super.gd>
Co-Authored-By: Andrew Stewart <andrew@super.gd>
Co-Authored-By: Harmony Bouvier <harmony@super.gd>
Co-Authored-By: Jared Norman <jared@super.gd>
Co-Authored-By: Kendra Riga <kendar@super.gd>
Co-Authored-By: Sofia Besenski <sofia@super.gd>
Co-Authored-By: Chris Todorov <chris@super.gd>
Co-Authored-By: Tom Van Manen <tom@super.gd>
Co-Authored-By: Noah Silvera <noah@super.gd>
This is calling the recalculate method not update_adjustments.

Co-Authored-By: Adam Mueller <adam@super.gd>
Co-Authored-By: Benjamin Willems <benjamin@super.gd>
Co-Authored-By: Andrew Stewart <andrew@super.gd>
Co-Authored-By: Harmony Bouvier <harmony@super.gd>
Co-Authored-By: Jared Norman <jared@super.gd>
Co-Authored-By: Kendra Riga <kendar@super.gd>
Co-Authored-By: Sofia Besenski <sofia@super.gd>
Co-Authored-By: Chris Todorov <chris@super.gd>
Co-Authored-By: Tom Van Manen <tom@super.gd>
Co-Authored-By: Noah Silvera <noah@super.gd>
This puts all the update and recalculate methods together.

Co-Authored-By: Adam Mueller <adam@super.gd>
Co-Authored-By: Benjamin Willems <benjamin@super.gd>
Co-Authored-By: Andrew Stewart <andrew@super.gd>
Co-Authored-By: Harmony Bouvier <harmony@super.gd>
Co-Authored-By: Jared Norman <jared@super.gd>
Co-Authored-By: Kendra Riga <kendar@super.gd>
Co-Authored-By: Sofia Besenski <sofia@super.gd>
Co-Authored-By: Chris Todorov <chris@super.gd>
Co-Authored-By: Tom Van Manen <tom@super.gd>
Co-Authored-By: Noah Silvera <noah@super.gd>
We want to start breaking out some of the complex logic of the in memory
updater into smaller more focused classes.

Co-Authored-By: Adam Mueller <adam@super.gd>
Co-Authored-By: Benjamin Willems <benjamin@super.gd>
Co-Authored-By: Andrew Stewart <andrew@super.gd>
Co-Authored-By: Harmony Bouvier <harmony@super.gd>
Co-Authored-By: Jared Norman <jared@super.gd>
Co-Authored-By: Kendra Riga <kendar@super.gd>
Co-Authored-By: Sofia Besenski <sofia@super.gd>
Co-Authored-By: Chris Todorov <chris@super.gd>
Co-Authored-By: Tom Van Manen <tom@super.gd>
Co-Authored-By: Noah Silvera <noah@super.gd>
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Dec 7, 2024
@jarednorman jarednorman closed this Dec 7, 2024
@jarednorman
Copy link
Member

Could you rebase this against the latest changes in the existing PR and push that up next week?

@jarednorman jarednorman mentioned this pull request Dec 11, 2024
3 tasks
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.

5 participants