Class results table not working for multiplayer sim

Hi Support Team,

We’re facing an issue with the Class Results page from the interface builder not allowing us to ‘View’ a player’s runs in one of our multiplayer simulations.

The issue doesn’t occur to the latest run but on all preceding runs. The username in the ‘User’ column of the runs table changes to Anonymous as shown below:

And on clicking on ‘View’, the following error is shown:

image

Error text:

https://forio.com/v2/run/tr/cell-dev/0000018843c4891d1ef36fd7b9410060cddc/variables/?include=Step,user:role,TargetReductionPerc,NumYears,Locationname
400: Bad Request
Type: java.lang.NullPointerException

The issue doesn’t happen to the latest run but to all preceding runs. We suspect the error is showing because the simulation is a multiplayer project.

Please let us know how we can fix this, since it is an important feature of our simulation.

Kind regards
Wesley

Dear Wesley,

If you look in the dev tools at the network call you’ll see that it is trying to request the variable “user:role” from the server, which does not exist. That gives the error.

The cause of this is that the student page is displaying the role (somewhere on the page). However, when you impersonate from the Class results, there is no role. (you are not impersonating by student but rather in general).

I saw this worked with the most recent runs but not the older ones. I’m not sure why that is.

I don’t have a specific set of workarounds, but the following thoughts may be a starting point.

What role specific data is in the student screens, and what do you wish the facilitator to see? Is it possible to remove references to the student role in the student page? Alternately, you may want to use javascript to remove role specific material when impersonating.

Hi Will,

Here is a follow up to our communication yesterday. We solved one issue and have one issue still outstanding regarding this thread.

I noticed that (in the facilitator interface) the most recent run does not request for the variable “user:role” but all preceding runs do.

In our simulation we have two roles: Decision_Maker and Analyst.

The Decision_Maker is able to make decisions (manipulate the input elements) whereas these input elements are disabled for the Analysts.

The navigation menu shows different pages to the user based on their role (some pages have a Decision_Maker version and Analyst version).

On inspecting the class results table using dev tools, I noticed that the first run has &view-as-role=Decision_Maker parameter attached to the end of the URL as shown in the screenshot below:

Note that the second run doesn’t have the parameter attached at the end of the URL.

We were able to get the URLs to work by adding this parameter to all of the URLs in the table through the following javascipt code in the Class Results page:

  $(function () {
            setTimeout(() => {
                let links = $('tr[role="row"]:not(:first)>td:last-child>a');
                for (const i of links) {
                    href = i.href;
                    // Check if href contains '&view-as-role=Decision_Maker', if it doesn't exist then add it to the end of href, otherwise leave href unchanged
                    i.href = href.includes('&view-as-role=Decision_Maker') ? href : href + '&view-as-role=Decision_Maker';
                }
            }, 2000);
        });

However, we are still not able to fix the User column showing as ‘Anonymous’ in the Class Results table. Your thoughts on how this can be solved are much appreciated.

Kind regards
Wesley

The reason the User column is “Anonymous” is because this shows an individual user. With a multiplayer sim, there is no one user.

You could use JavaScript to retrieve the list of users from the world API and insert it into this table.

As per the first screenshot above, the various usernames are shown in the User column when people play in a team, but they are replaced by Anonymous if they start a new run (or sometimes it happens by itself after a period of time). This also happens if the team consists of just one user.

I’m grateful for any guidance you can provide.

Hi Will,

Can you please provide some guidance on how to retrieve the list of users in a world from the world API and insert them into the class results table?

Kind regards
Wesley