-
Notifications
You must be signed in to change notification settings - Fork 2
👔(backend) update organization assignation logic #1082
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
Conversation
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.
Pull Request Overview
This pull request updates the organization assignation logic to ignore orders with pending signature, orders without a payment method, and refunded/refunding orders. Key changes include updating the test to randomly select non-binding order states, modifying the client API filtering logic, and updating the changelog.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/backend/joanie/tests/core/api/order/test_create.py | Updated order creation tests to randomly choose ignored order states for first organization and batch creation for the second organization. |
| src/backend/joanie/core/api/client/init.py | Modified the organization selection filter and updated the related docstring to reflect new binding order criteria. |
| CHANGELOG.md | Documented changes in organization assignation logic regarding order states to ignore. |
| product=relation.product, | ||
| course=relation.course, | ||
| state=enums.ORDER_STATE_DRAFT, | ||
| state=lazy(lambda: random.choice(ignored_states), str)(), |
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'd rather keep deterministic states, without random.choice.
I will add a fixup.
01a1cae to
6bda6bc
Compare
|
I just added tests, as current one doesn't cover the code. |
wilbrdt
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.
Being nitpicky but looks good to me!
19ced06 to
c2f3fda
Compare
Currently only orders with inactive states (canceled, draft, assigned) were ignored in the organization assignation logic. But orders pending for signature or without payment method are take in account but most of time this kind of orders are abandoned. So it has been ask to ignore this kind of order during assignation. Furthermore, we did not ignore refunded and refunding orders. Resolve #1081
c2f3fda to
4642af7
Compare
Purpose
Currently only orders with inactive states (canceled, draft, assigned) were ignored in the organization assignation logic. But orders pending for signature or without payment method are take in account but most of time this kind of orders are abandoned. So it has been ask to ignore this kind of order during assignation. Furthermore, we did not ignore refunded and refunding orders.
Resolve #1081