Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 360d16b

Browse files
committed
Get the shortanswer javascript liming along, using localstorage and logging.
1 parent 73cb4b1 commit 360d16b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

runestone/shortanswer/js/shortanswer.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
*
77
*/
88
function loadJournal(directive_id) {
9-
directiveRemoteCommand('get_journal_entry', directive_id, {},
9+
if (storage.has(directive_id)) {
10+
var solution = $('#' + directive_id + '_solution');
11+
solution.text(storage.get(directive_id));
12+
}
13+
14+
/*directiveRemoteCommand('get_journal_entry', directive_id, {},
1015
function(data) {
1116
var solution = $('#'+directive_id+'_solution');
1217
solution.text(data.solution);
@@ -21,19 +26,21 @@ function loadJournal(directive_id) {
2126
},
2227
function(data) {
2328
console.log(data.message);
24-
});
29+
}); */
2530
}
2631

2732
function submitJournal(directive_id) {
2833
var value = $('#'+directive_id+'_solution').val();
2934
storage.set(directive_id, value);
35+
/*
3036
directiveRemoteCommand('set_journal_entry', directive_id, {'solution': value},
3137
function(data) {
3238
storage.remove(directive_id);
3339
},
3440
function(data) {
3541
console.log(data.message);
36-
});
42+
}); */
43+
logBookEvent({'event': 'shortanswer', 'act': JSON.stringify(value), 'div_id': directive_id});
3744
}
3845

3946

0 commit comments

Comments
 (0)