Skip to content

Commit

Permalink
fixes #103 and #108
Browse files Browse the repository at this point in the history
  • Loading branch information
hhzl committed Dec 19, 2016
1 parent 6c90be0 commit cf0885d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion spec/learnwords2/LWBoxOfQuestionsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ describe("BoxOfQuestions", function() {
var n = settings.numberOfOptions;

var options = LW.getAnswerOptions();


expect(options).toBeArray();
expect(options.length).toBe(n);


Expand Down
13 changes: 11 additions & 2 deletions src/BoxOfQuestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ function BoxOfQuestions(db) {




var _shuffle =function(a) {
var j, x, i;
for (i = a.length; i; i--) {
j = Math.floor(Math.random() * i);
x = a[i - 1];
a[i - 1] = a[j];
a[j] = x;
};
return a
};



Expand Down Expand Up @@ -231,7 +240,7 @@ function BoxOfQuestions(db) {


};
return options
return _shuffle(options)
},


Expand Down
11 changes: 3 additions & 8 deletions src/LWdb.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@

// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// NOTE: pay special attention to how the number of Words is calculated
// FIXME
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



"use strict";
// ----------------------------------------------------------------------
// LearnWords 2
Expand Down Expand Up @@ -298,7 +290,10 @@ var LWdb = function(name) {
_keysOfAllWords.push(key);
}
};
// _setNumberOfWords(_keysOfAllWords.length);
// as putWord() updates n
_indexHasBeenUpdated();

};
return _keysOfAllWords;
},
Expand Down

0 comments on commit cf0885d

Please sign in to comment.