ArgLab / ArgLab_writing_observer

Writing Observer and Learning Observer: A system for monitoring learning process data, with an initial focus on writing process data from Google Docs.
GNU Affero General Public License v3.0
3 stars 2 forks source link

Fixing the order of students #39

Open bradley-erickson opened 1 year ago

bradley-erickson commented 1 year ago

The student cards are initially set when the student roster information is updated. This is done with an async call to /webapi/courseroster/<course_id>. The code for creating a card for each student can be found here.

When each the websocket data is updated, the student data is updated on all the cards. This means our return statement needs to be a list of JSON objects where each object corresponds to a single student's data. This is where the problem lies. When updating, we return the data in the same order as the server. No special handling to take care of ordering. This update is done here in Javascript.

Instead of updating updates[i], where i is the index of the server data. It needs to match where the data should go.

Steps:

  1. Grab curr_user=data[i].userId of update from server (inside for loop)
  2. Then figure out the appropriate index of the curr_user from the old_data. Search the old_data list for the index that has the matching id as curr_user.
  3. Set updates[user_index] instead of updates[i].