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
{{ message }}
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
@@ -75,11 +88,6 @@ class LP extends RunestoneBase {
75
88
// Keep track of it.
76
89
that.textAreas.push(editor);
77
90
});
78
-
// Handle clicks to the "Save and run" button.
79
-
$(this.element).click((eventObject)=>
80
-
that.onSaveAndRun(eventObject).then(null)
81
-
);
82
-
this.checkServer("lp_build",true);
83
91
}
84
92
85
93
// Data structures:
@@ -213,17 +221,29 @@ class LP extends RunestoneBase {
213
221
214
222
// Store an array of strings in ``data.code_snippets`` into each textarea.
215
223
dataToTextareas(data){
216
-
// Find all code snippet textareas.
224
+
// For places where textareas aren't provided (instructor grading interface, assignment page), create them. However, these aren't runnable, so disable the "Save and run" button. Assume this is the case when there are no textareas. Reasoning: the page containing the problem contains code intended to be intermingled with the student's answer. If that's not present, we can't build.
225
+
if(!this.textAreas.length){
226
+
// The unusual case -- a problem not on its original page. Create textareas to display the code, then initialize them. Note that we can't simply create these in the constructor (which would be convenient) since we don't yet know how many code snippets are associated with the problem.
// Corner case TODO: if a problem is edited after students already submit code so that there are now fewer textareas, display these but don't save them when "Save and run" is pressed. This allows students to (hopefully) re-use code from now-discarded textareas.
221
241
}
222
242
223
243
// Restore answers from storage retrieval done in RunestoneBase.
224
244
restoreAnswers(data){
225
-
// We store the answer as a JSON-encoded string in the db / local storage. Restore the actual data structure from it.
226
-
data.answer=JSON.parse(data.answer);
245
+
// We store the answer as a JSON-encoded string in the db / local storage. Restore the actual data structure from it. Avoid exceptions if no data is available.
0 commit comments