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

In the OC edit page, load products only when each products tab is opened by user #4455

Merged
merged 21 commits into from
Dec 17, 2019

Conversation

luisramos0
Copy link
Contributor

@luisramos0 luisramos0 commented Nov 11, 2019

What? Why?

Non tech explanation: there's no functional change in this PR. This is a preparation for loading exchange products in pages which will allow us to handle thousands of products in each exchange.

Continuation of #4379 and starts #4476
Closes #4144

Tech explanation: here I basically moved the repeat statement
"supplied_products | filter:productSuppliedToOrderCycle" to a new server endpoint
and that will allow us to improve it and convert it into a optimized (and paginated?) DB query as well as remove the algorithm from the js side, namely, OrderCycle.productSuppliedToOrderCycle.

The supplied products of both incoming and outgoing exchanges are now loaded into separate data structures (one for each enterprise, no global supplied_products anymore) and can now be loaded when the panel of products is opened for the first time.
This is happening on the outgoing exchanges. The incoming exchanges are still loading all the products on page load so that the total number of variants is displayed to the user. We can LATER move this products count to a specific server side call.

Here we maintain all the exchange "editable_" and "visible_" data structures, that data comes from the server as part of each exchange and is applied as a filter in the ng-repeat. We can improve this later by moving it as well to this new ExchangeProductsController!

The next big step would be to build pagination on the exchangeproducts controller.

What should we test?

This is a big change. We need to validate every aspect of the Order Cycle create and edit pages, both single enterprise and multiple enterprise.

Release notes

Changelog Category: Changed
The Order Cycle edit page is now faster in some situation as less data is loaded to the browser.

@luisramos0 luisramos0 changed the title Oc prods WIP In the OC edit page, load products only when exhcange tab is opened by user Nov 11, 2019
@luisramos0 luisramos0 changed the title WIP In the OC edit page, load products only when exhcange tab is opened by user WIP In the OC edit page, load products only when each products tab is opened by user Nov 11, 2019
@luisramos0 luisramos0 self-assigned this Nov 11, 2019
@luisramos0 luisramos0 force-pushed the oc_prods branch 9 times, most recently from a5bb8c7 to 3537279 Compare November 16, 2019 17:42
@luisramos0 luisramos0 force-pushed the oc_prods branch 9 times, most recently from 144dba1 to 66f0261 Compare November 17, 2019 17:43
@luisramos0 luisramos0 removed the pr-wip label Nov 17, 2019
@luisramos0 luisramos0 changed the title WIP In the OC edit page, load products only when each products tab is opened by user In the OC edit page, load products only when each products tab is opened by user Nov 17, 2019
@RachL RachL added pr-staged-fr staging.coopcircuits.fr and removed pr-staged-es labels Dec 4, 2019
@RachL RachL removed their assignment Dec 4, 2019
@luisramos0
Copy link
Contributor Author

Heads up testers, #4471 builds on top of this PR and both are in test ready.
Maybe easier to stage and test only #4471 and verify both PRs there.

@RachL RachL removed the pr-staged-fr staging.coopcircuits.fr label Dec 9, 2019
…e exchange products panel work for outgoing exchanges
This list of products s now loaded in a specific call to ExchangeProducts and for each specific exchange
Currently we are just loading the products from the server and count them.
This can be improved easily in two ways:
- we can switch this to a specific product count call to the server so that we dont load all products all the time
- or we paginate the products result and fetch the total_number from the payload of the first page.
This is needed when products for an exchange that is not yet saved are requested
…of using recurrent timeouts

Also, use this same approach for the case where a new distributor or new supplier is added to the list of exchanges
Simple create makes a new type of call to exchange products with no exchange_id and no prder_cycle_id, it simply lists supplied products for a given enterprise
…ructure, that is already kept in the controller
…t exchange_id) also go to exchange_products#index
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

Successfully merging this pull request may close these issues.

OC edit performance: Angular
5 participants