Skip to content

Commit

Permalink
Fixed #1181 - Adaptive content page not always showing correct data $…
Browse files Browse the repository at this point in the history
…release $bugfix
  • Loading branch information
torinfo committed Dec 5, 2022
1 parent d51fb0d commit 5334cdc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
10 changes: 6 additions & 4 deletions modules/site/xAPI/xttracking_xapi.js
Expand Up @@ -1894,14 +1894,16 @@ function getStatements(q, one, callback)
// lastSubmit = JSON.parse(sr.statements[x].result.extensions["http://xerte.org.uk/xapi/JSONGraph"]);
//}
if (group != ""
&& (body.statements[x].context.team == undefined
&& (body.statements[x].context == undefined
|| body.statements[x].context.team == undefined
|| body.statements[x].context.team.account == undefined
|| body.statements[x].context.team.account.name == undefined
|| body.statements[x].context.team.account.name != group)) {
continue;
}
if (context_id != ""
&& (body.statements[x].context.extensions == undefined
&& (body.statements[x].context == undefined
|| body.statements[x].context.extensions == undefined
|| body.statements[x].context.extensions["http://xerte.org.uk/lti_context_id"] == undefined
|| body.statements[x].context.extensions["http://xerte.org.uk/lti_context_id"] != context_id)) {
continue;
Expand All @@ -1914,8 +1916,8 @@ function getStatements(q, one, callback)
// TODO: do something with error, didn't get statements
return;
}
if (res.more && res.more !== "") {
ADL.XAPIWrapper.getStatements(null, res.more, getmorestatements);
if (body.more && body.more !== "") {
ADL.XAPIWrapper.getStatements(null, body.more, getmorestatements);
} else {
callback(statements, search);
}
Expand Down
Expand Up @@ -77,6 +77,21 @@ li.select-interaction.selected {
font-size:smaller;
}

.interaction_load {
position: relative;
left: 50%;
top: 50%;
width: 66px;
margin-left: -33px; /* -1 * div width / 2 */
}

.loader-gif {
margin-left: auto;
margin-right:auto;
display:block;
}


#adaptiveContentMain .splitScreen .left, #adaptiveContentMain .splitScreen .right {
overflow-y: auto;
}
Expand Down
Expand Up @@ -1186,6 +1186,7 @@
div.html(
`<h2><p>${name}</p></h2>` +
`<div class='introduction'>${introductionText}</div>` +
'<div class="interaction_load" id="interaction_load_' + interactionIndex + '"><img class="loading-gif" src="' + x_templateLocation + 'common_html5/loading16.gif"/></div>' +
'<div class="summary-container">' +
summaryDiv +
graphContainer +
Expand Down Expand Up @@ -1431,6 +1432,8 @@
interactionIndex,
fullWidth
) {
// remove loader
$("#interaction_load_" + interactionIndex).remove();
let scoreLabelText = interaction.getAttribute("scoreText");
if (scoreLabelText == null) {
scoreLabelText = "Your score is {0}";
Expand Down Expand Up @@ -2272,6 +2275,9 @@
interactionIndex,
fullWidth
) {
// remove loader
$("#interaction_load_" + interactionIndex).remove();

var answerLabelText = interaction.getAttribute("answerText");
if (answerLabelText == undefined) {
answerLabelText = "Your answer is {0}";
Expand Down Expand Up @@ -2571,6 +2577,9 @@
interactionIndex,
fullWidth
) {
// remove loader
$("#interaction_load_" + interactionIndex).remove();

var scoreLabelText = interaction.getAttribute("scoreText");
if (scoreLabelText == null) {
scoreLabelText = "Your score is {0}";
Expand Down Expand Up @@ -2659,6 +2668,9 @@
interactionIndex,
fullWidth
) {
// remove loader
$("#interaction_load_" + interactionIndex).remove();

var answerLabelText = interaction.getAttribute("answerText");
if (answerLabelText == undefined) {
answerLabelText = "Your answer is {0}";
Expand Down Expand Up @@ -2799,6 +2811,9 @@
interactionIndex,
fullWidth
) {
// remove loader
$("#interaction_load_" + interactionIndex).remove();

// reshuffle
var groupingStatements = [];
var userGrouping = [];
Expand Down
10 changes: 6 additions & 4 deletions modules/xerte/xAPI/xttracking_xapi.js
Expand Up @@ -1894,14 +1894,16 @@ function getStatements(q, one, callback)
// lastSubmit = JSON.parse(sr.statements[x].result.extensions["http://xerte.org.uk/xapi/JSONGraph"]);
//}
if (group != ""
&& (body.statements[x].context.team == undefined
&& (body.statements[x].context == undefined
|| body.statements[x].context.team == undefined
|| body.statements[x].context.team.account == undefined
|| body.statements[x].context.team.account.name == undefined
|| body.statements[x].context.team.account.name != group)) {
continue;
}
if (context_id != ""
&& (body.statements[x].context.extensions == undefined
&& (body.statements[x].context == undefined
|| body.statements[x].context.extensions == undefined
|| body.statements[x].context.extensions["http://xerte.org.uk/lti_context_id"] == undefined
|| body.statements[x].context.extensions["http://xerte.org.uk/lti_context_id"] != context_id)) {
continue;
Expand All @@ -1914,8 +1916,8 @@ function getStatements(q, one, callback)
// TODO: do something with error, didn't get statements
return;
}
if (res.more && res.more !== "") {
ADL.XAPIWrapper.getStatements(null, res.more, getmorestatements);
if (body.more && body.more !== "") {
ADL.XAPIWrapper.getStatements(null, body.more, getmorestatements);
} else {
callback(statements, search);
}
Expand Down

0 comments on commit 5334cdc

Please sign in to comment.