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

Multi-PUT, order of events is uncontrollable and can mess with model validation #58

Open
stam opened this issue Jun 16, 2017 · 0 comments

Comments

@stam
Copy link
Contributor

stam commented Jun 16, 2017

In TMS we have an Order model which has multiple Activities.
In the Order model, we define some constraints about the Activities.

When we do a MultiPUT on /api/order, we cannot control the order in which the models are saved.
It can occur that the Order model is saved before the Activity models, this causes Order.clean to be fired prematurely: the order.activities will contain the old version of the activities.

When the activities themselves are saved, the Order.clean isn't called afterwards and we are left with data which is invalid by our constraints.

A failing testcase of this behavior can be found here:
https://bitbucket.org/codeyellow/tms/src/ed1f0b7c4ef3071911b856a9ea47abf9d8818385/backend/commerce/tests/test_order.py?fileviewer=file-view-default#test_order.py-177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant