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:
Grab curr_user=data[i].userId of update from server (inside for loop)
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.
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]
, wherei
is the index of the server data. It needs to match where the data should go.Steps:
curr_user=data[i].userId
of update from server (inside for loop)curr_user
from theold_data
. Search theold_data
list for the index that has the matchingid
ascurr_user
.updates[user_index]
instead ofupdates[i]
.