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.
@@ -78,22 +78,72 @@ class LP extends RunestoneBase {
78
78
this.checkServer("lp_build",true);
79
79
}
80
80
81
+
// Data structures:
82
+
//
83
+
// Format of data stored locally and on the server*::
84
+
//
85
+
// - answer: JSON-encoded string containing {
86
+
// code_snippets: [
87
+
// str, snippet 1, ...
88
+
// ],
89
+
// (optional) resultString: str, output from build.
90
+
// }
91
+
// - correct: (optional) float, a percentage from 0 to 100.
92
+
// - timestamp: date/time in UTC.
93
+
//
94
+
// Format of data sent to the server*::
95
+
//
96
+
// - answer: JSON-encoded string containing only the code_snippets
97
+
// array, not resultString. There's no point in sending the
98
+
// previous resultString, since the server will compute a new
99
+
// one.
100
+
// - event: "lp_build"
101
+
// - act: "", since the useinfo table requires it. It's not
102
+
// otherwise used.
103
+
// - path: str, giving the relative path to this web page. Used
104
+
// to find the source code which produced this page in order
105
+
// to do snippet replacement.
106
+
// - div_id: str, the div_id of this component.
107
+
//
108
+
// Format of data received from the server::
109
+
//
110
+
// If there was an error:
111
+
// - errors: [
112
+
// str, error message 1, ...
113
+
// ]
114
+
//
115
+
// Otherwise:
116
+
// - answer: JSON-encoded string containing {
117
+
// resultString: str, output from build.
118
+
// Note that the code_snippets aren't sent back, to save
119
+
// bandwidth.
120
+
// }
121
+
// - correct: float, a percentage from 0 to 100.
122
+
// - timestamp: str, the server's timestamp.
123
+
//
124
+
// * For simplicity, I omitted the common fields (course, etc.) and discussed only fields unique to this component.
125
+
81
126
asynconSaveAndRun(_eventObject){
127
+
// Prevent multiple click while the build is running.
128
+
$(this.element).attr("disabled",true);
82
129
$(this.resultElement).val("Building...");
83
130
$(this.feedbackElement).text("").attr("");
84
131
// Since the Save and run button was clicked, we assume the code snippets have been changed; therefore, don't store ``correct`` or ``answer.resultString`` because they are out of date.
// Store the answer as a string, since this is what goes in to / comes out from the database. We have to translate this back to a data structure when restoring from the db or local storage.
0 commit comments