File tree Expand file tree Collapse file tree
components/rsptx/templates/assignment/student Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments