word/quiz: report table to save user actions
[sheet.git] / word / wijzer.js
index 5f2a3bba9ad40ec5a4253ce6310dd8ec269caefb..7446cc990e1231c7881041892c79da5e4d6e0457 100644 (file)
@@ -6,6 +6,7 @@ class WordWijzer extends WordQuiz {
                        this.form.querySelectorAll('li[onclick]').forEach(answer => {
                                answer.removeAttribute('onclick');
                        });
+                       this.log('done');
                        return;
                }
 
@@ -22,6 +23,7 @@ class WordWijzer extends WordQuiz {
                console.log(this.question, answer);
                let match = this.question.dataset.id == answer.dataset.id;
                put(answer, match ? '.good' : '.wrong');
+               this.log('pick', answer.dataset.id, answer.index, this.question.dataset.id);
                this.next();
        }
 
@@ -32,10 +34,13 @@ class WordWijzer extends WordQuiz {
 
                let answers = put(this.form, 'ul');
                this.words
-                       .forEach(answer => {
+                       .forEach((answer, seq) => {
                                let label = answer[0].replace(/\/.*/, ''); // primary form
                                put(answers, 'li[data-id=$][onclick=""]',
-                                       answer[2], label, {onclick: e => this.verify(e)}
+                                       answer[2], label, {
+                                               onclick: e => this.verify(e),
+                                               index: seq,
+                                       }
                                )
                        });
                this.words.shuffle();