Skip to content

Commit e4cd31b

Browse files
committed
Construct currentAssignmentInfo object
1 parent 3c16d61 commit e4cd31b

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

components/rsptx/templates/assignment/student/doAssignment.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,30 @@ <h3>Questions</h3>
233233

234234
<script>
235235
assignmentId = {{ assignment.id }};
236-
localStorage.setItem("currentAssignmentId", assignmentId);
236+
237+
var readingsInfo = {{ readings | tojson | safe }}
238+
var questionInfo = {{ questioninfo | tojson | safe }};
239+
console.log(readingsInfo);
240+
console.log(questionInfo);
241+
242+
let subchapList = []
243+
let qlist = []
244+
for (let chapter in readingsInfo) {
245+
for (let subchapter of readingsInfo[chapter]['subchapters']) {
246+
subchapList.push(subchapter['subchapter']);
247+
}
248+
}
249+
for (let q of questionInfo) {
250+
qlist.push(q['name']);
251+
}
252+
var assignmentInfo = {
253+
'name': "{{ assignment['name'] }}",
254+
'id': assignmentId,
255+
'readings': subchapList,
256+
'questions': qlist
257+
};
258+
localStorage.setItem("currentAssignmentInfo", JSON.stringify(assignmentInfo));
259+
237260
//console.log(document.getElementsByClassName('nav nav-tabs'))
238261
// This script renders the html into elements in the DOM
239262
// The html gets thrown into a script tag so javascript can mess with it without throwing errors all over the place

0 commit comments

Comments
 (0)