-
-
Notifications
You must be signed in to change notification settings - Fork 710
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a5bb8c7
to
3537279
Compare
luisramos0
commented
Nov 16, 2019
app/assets/javascripts/templates/admin/panels/exchange_distributed_products.html.haml
Outdated
Show resolved
Hide resolved
144dba1
to
66f0261
Compare
luisramos0
commented
Nov 17, 2019
… opened for the first time
…_order_cycle#supplied_products
… outgoing exchanges
…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
…the DB do the matching job
…ructure, that is already kept in the controller
…t exchange_id) also go to exchange_products#index
…ith a ng-init in the panel template
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.