Giter VIP home page Giter VIP logo

Comments (1)

k15z avatar k15z commented on August 31, 2024

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.

from bayms.web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.