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

Click on piece approval gets slow response #49

Closed
flowingus opened this issue Sep 8, 2015 · 1 comment
Closed

Click on piece approval gets slow response #49

flowingus opened this issue Sep 8, 2015 · 1 comment

Comments

@flowingus
Copy link
Collaborator

No description provided.

@k15z
Copy link
Owner

k15z commented Sep 11, 2015

Alright, let us fix this. And by "us", I actually mean someone on the BAYMS web dev team. (In other words, not me.)

Problem

The problem lies in the way the piece ordering system was designed. Fix the piece ordering, and the piece approval process will work much better than before.

Right now, to set the piece order, numerous AJAX calls are being made, one call for each piece in the program. Furthermore, each call is delayed by a couple hundred milliseconds in order to stop the database from locking up. This is a terrible way of handling it, but it was also the simplest way to get a prototype up and running in time for the first event of the year.

Solution

  1. Modify "bayms.php"; add an orderPieces function which accepts an associative array which maps piece_id's to piece_order's. This will allow us to set all the piece_orders in a single API call.
  2. Modify api.php; add a order_pieces API call which will decode a JSON object containing the piece_order's from the REQUEST variable. Call the orderPieces function using this object.
  3. Modify app.js; change the saveOrder function so that it sends all the piece_order values in a single AJAX request.

Extras

To further improve the efficiency, consider minimizing the number of piece_order values being sent. If a value hasn't changed, then don't send it.

To make it even more efficient, consider spacing out the values. Instead of "1, 2, 3, 4, 5...", consider using "10, 20, 30, 40, 50..."; using larger intervals will allow you to later set piece_order's to intermediate values such as 15 and only send a single change... at least, until you run out of room.

@zeNightq zeNightq closed this as completed Oct 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants