git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
word/quiz: preset configuration filters level
[sheet.git]
/
word
/
quiz.js
diff --git
a/word/quiz.js
b/word/quiz.js
index 361d075e66391f517b08b8f51f7a12222ef9b954..146aff73e61171c10f81779aad8be30777d7da35 100644
(file)
--- a/
word/quiz.js
+++ b/
word/quiz.js
@@
-8,11
+8,16
@@
Array.prototype.shuffle = function () {
class WordQuiz {
dataselect(json) {
class WordQuiz {
dataselect(json) {
+ // find viable rows from json data
let rows = Object.values(json);
let rows = Object.values(json);
+ if (this.preset.level !== undefined) {
+ rows = rows.filter(row => row[1] <= this.preset.level);
+ }
return rows.shuffle();
}
load(dataurl) {
return rows.shuffle();
}
load(dataurl) {
+ this.preset = {};
fetch(dataurl).then(res => res.json()).then(json => {
this.words = this.dataselect(json)
this.setup();
fetch(dataurl).then(res => res.json()).then(json => {
this.words = this.dataselect(json)
this.setup();