You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Containers version (if applicable) [e.g. the git hash]
To Reproduce
Steps to reproduce the behavior:
Go to A task and submit something
Click on the left on your old submission
The submission does not appear
Expected behavior
The submission should appear in the codemirror editor.
The Javascript error is raised in codemirror (minified) code :
UncaughtTypeError: e.splitisnotafunctionatBl(codemirror.js:3:106416)atva.splitLines(codemirror.js:3:127125)atva.<anonymous> (codemirror.js:3:119630)
at va.setValue (codemirror.js:3:53793)
at Do.setValue (codemirror.js:3:160479)
at load_input_code (task.js:740:30)
at load_input (task.js:732:52)
at Object.<anonymous> (task.js:685:17)
at u (jquery.min.js:2:27457)
at Object.fireWith [as resolveWith] (jquery.min.js:2:28202)
The line Bl (codemirror.js:3:106416) is return e.split(/\r\n?|\n/) e should contain the submission code. Instead, e is an Array whose first and only value is the submission code. e is ['def fn():\r\n...'] instead of 'def fn():\r\n...'.
Looking in the call stack I looked at Object.<anonymous> (task.js:685:17) :
function loadOldSubmissionInput(id, with_feedback)
{
if(loadingSomething)
return;
blurTaskForm();
resetAlerts();
displayTaskInputLoadingAlert();
var url = $('form#task').attr("action");
jQuery.post(url, {"@action": "load_submission_input", "submissionid": id}, null, "json")
.done(function(data)
{
if("status" in data && data['status'] == "ok" && "input" in data)
{
updateMainTags(data);
unblurTaskForm();
load_input(id, data['input']);
if(with_feedback) // load feedback in second place as it may affect the input
loadOldFeedback(data);
}
else
{
displayTaskInputErrorAlert();
unblurTaskForm();
}
}).fail(function()
{
displayTaskInputErrorAlert();
unblurTaskForm();
});
}
Using the chrome debugger, I saw that data['input']['sub01'] (sub01 is the name of the only subproblem of my task) is an Array. I think it should be a string. I added this line data['input']['sub01'] = data['input']['sub01'][0]; just before load_input(id, data['input']);
Everything works fine !
Sure there is a better fix (may be the issue is in the chunks stored in the database...?), and I would like to know if I am the only one facing this issue
The text was updated successfully, but these errors were encountered:
lsignac
changed the title
Add the context of the bug at the beginning of the title, if possible, e.g. [frontend/installer]
frontend : unable to visualize past submissions (javascript error)
Sep 2, 2024
Instead of changing the loadOldSubmissionInput function, I preferred to go further in the stacktrace and I used the following fix in tasks.js - function load_input_code (approx. line 740) to replace the array by its content (input[key] => input[key][0]) :
function load_input_code(submissionid, key, input)
{
if(key in codeEditors) {
if(key in input)
codeEditors[key].setValue(input[key][0], -1); // BugFix
else
codeEditors[key].setValue("", -1);
}
else {
var field = $("input[name='" + key + "']");
if(key in input)
$(field).val(input[key][0]); //BugFix
else
$(field).val("");
}
}
Seems to be working for now, but I'm not sure about possible side effects. I'd be happy with an official fix :-).
Describe the bug
students can not access old submissions, due to a Javascript Error.
INGInious installation details
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The submission should appear in the codemirror editor.
The Javascript error is raised in codemirror (minified) code :
The line
Bl (codemirror.js:3:106416)
isreturn e.split(/\r\n?|\n/)
e
should contain the submission code. Instead,e
is an Array whose first and only value is the submission code.e
is['def fn():\r\n...']
instead of'def fn():\r\n...'
.Looking in the call stack I looked at
Object.<anonymous> (task.js:685:17)
:Using the chrome debugger, I saw that
data['input']['sub01']
(sub01
is the name of the only subproblem of my task) is an Array. I think it should be a string. I added this linedata['input']['sub01'] = data['input']['sub01'][0];
just beforeload_input(id, data['input']);
Everything works fine !
Sure there is a better fix (may be the issue is in the chunks stored in the database...?), and I would like to know if I am the only one facing this issue
The text was updated successfully, but these errors were encountered: