.
This commit is contained in:
+2
-4
@@ -110,19 +110,17 @@ function submissionError(data, ans) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: async request
|
|
||||||
export function getQuestion(url, question_number, question_total) {
|
export function getQuestion(url, question_number, question_total) {
|
||||||
console.log("Downloading ", url, question_number, question_total);
|
console.log("Downloading question ", url, question_number, question_total);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: url,
|
url: url,
|
||||||
progress: function (e) {
|
progress: function (e) {
|
||||||
console.log(e);
|
|
||||||
if (e.lengthComputable) {
|
if (e.lengthComputable) {
|
||||||
var completedPercentage = Math.round((e.loaded * 100) / e.total);
|
var completedPercentage = Math.round((e.loaded * 100) / e.total);
|
||||||
|
|
||||||
$("#progress").html(
|
$("#progress").html(
|
||||||
`Downloading [${question_number}/${question_total}]${completedPercentage}%<br/>${helper.formatBytes(
|
`Downloading question [${question_number}/${question_total}]<br/>${completedPercentage}%<br/>${helper.formatBytes(
|
||||||
e.total
|
e.total
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-12
@@ -465,21 +465,10 @@ function setUpPacket(data, path) {
|
|||||||
//request_numbers.push(n)
|
//request_numbers.push(n)
|
||||||
data["questions"][n] = question_json;
|
data["questions"][n] = question_json;
|
||||||
}
|
}
|
||||||
|
// Once all questions have been downloaded we carry on loading
|
||||||
loadSession();
|
loadSession();
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|
||||||
//(async () => {
|
|
||||||
// for(let f of requests){
|
|
||||||
// var json = await f;
|
|
||||||
// console.log(json)
|
|
||||||
//};
|
|
||||||
//})()
|
|
||||||
|
|
||||||
//$.when.apply($,requests).then(function(){
|
|
||||||
// console.log(arguments); //array of responses [0][data, status, xhrObj],[1][data, status, xhrObj]...
|
|
||||||
//})
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Just carry on loading
|
// Just carry on loading
|
||||||
loadSession();
|
loadSession();
|
||||||
|
|||||||
Reference in New Issue
Block a user