diff --git a/djAerolith/flashcards/templates/flashcards/index.html b/djAerolith/flashcards/templates/flashcards/index.html
index 42f66a55..5ff5f020 100644
--- a/djAerolith/flashcards/templates/flashcards/index.html
+++ b/djAerolith/flashcards/templates/flashcards/index.html
@@ -1,5 +1,7 @@
{% load value_from_settings %}
+{% value_from_settings DEBUG as DEBUG %}
+
@@ -150,9 +152,13 @@ Look up Word
'quizzes': "{{savedLists|escapejs}}"
};
-
- {% include "flashcards_dynamic/flashcards_include.html" %}
-
+{% if DEBUG %}
+
+
+
+{% else %}
+ {% include "flashcards_dynamic/flashcards_include.html" %}
+{% endif %}
diff --git a/djAerolith/wordwalls/static/js/wordwalls/test/wordwalls_game.test.js b/djAerolith/wordwalls/static/js/wordwalls/test/wordwalls_game.test.js
index 7da8a4de..fb27dda0 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/test/wordwalls_game.test.js
+++ b/djAerolith/wordwalls/static/js/wordwalls/test/wordwalls_game.test.js
@@ -322,4 +322,18 @@ describe('Internal functions', () => {
}
});
});
+
+ describe('alphagrammize', () => {
+ it('should alphagrammize properly', () => {
+ const testArray = [
+ ['ROBINIA', 'ABIINOR'],
+ ['ÑU', 'ÑU'],
+ ['PERSPICACITY', 'ACCEIIPPRSTY'],
+ ['ĆCZ13ŹÑ', 'CĆ1Ñ3ZŹ'],
+ ];
+ for (let i = 0; i < testArray.length; i += 1) {
+ expect(Internal().alphagrammize(testArray[i][0])).toEqual(testArray[i][1]);
+ }
+ });
+ });
});
diff --git a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx
index 6da197de..dfb06ad1 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx
+++ b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_app_container.jsx
@@ -134,21 +134,16 @@ class WordwallsAppContainer extends React.Component {
if (!game.answerExists(modifiedGuess)) {
// If the guess wasn't valid, don't bother submitting it to
// the server.
- // console.log('not valid');
if (game.originalAnswerExists(modifiedGuess)) {
- // console.log('original answer exists')
this.setState({
lastGuessCorrectness: GuessEnum.ALREADYGUESSED,
});
} else {
- // console.log('does not exist')
if (game.markPotentialIncorrectGuess(modifiedGuess)) {
- // console.log('game.markpotentialincorrectguess')
this.setState(state => ({
wrongAnswers: state.wrongAnswers + 1,
}));
}
- // console.log('setting to incorrect')
this.setState({
lastGuessCorrectness: GuessEnum.INCORRECT,
});
diff --git a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js
index 5b1281fc..da724b0a 100644
--- a/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js
+++ b/djAerolith/wordwalls/static/js/wordwalls/wordwalls_game.js
@@ -8,16 +8,29 @@
import Immutable from 'immutable';
import _ from 'underscore';
+const LETTER_SORT_MAP = {};
+const SORT_STRING_ORDER = 'AĄBCĆ1DEĘFGHIJKLŁ2MNŃÑOÓPQR3SŚTUVWXYZŹŻ?';
+
+function makeLetterSortMap() {
+ for (let i = 0; i < SORT_STRING_ORDER.length; i += 1) {
+ LETTER_SORT_MAP[SORT_STRING_ORDER[i]] = i;
+ }
+}
+
/**
- * Alphagrammize the word. Note - this is not necessarily in the correct
- * sort order for non-english lexica, which means there may be a disconnect
- * between how the alphagram question comes in, and what this function
- * spits out. This should not be an issue if this function is used
- * consistently.
+ * Alphagrammize the word. Note - this follows the same "ghetto" function
+ * used in models.py, and handles Spanish, English, and Polish. This may need
+ * to be reworked.
* @param {string} word
*/
function alphagrammize(word) {
- return word.split('').sort().join('');
+ if (_.size(LETTER_SORT_MAP) === 0) {
+ makeLetterSortMap();
+ }
+ return word
+ .split('')
+ .sort((a, b) => LETTER_SORT_MAP[a] - LETTER_SORT_MAP[b])
+ .join('');
}
/**
@@ -193,8 +206,6 @@ class Game {
if (!question) {
return false;
}
- // console.log('found question!!', question);
- // console.log('updating in', this.origQuestions);
this.origQuestions = this.origQuestions.update(question, (aObj) => {
const newObj = aObj.set('wrongGuess', true);
return newObj;
@@ -213,8 +224,8 @@ class Game {
}
/**
- * Return the specific question if the guess is an anagram of any of
- * the unanswered questions, or null.
+ * Return the specific question string if the guess is an anagram of
+ * any of the unanswered questions, or null.
* @param {string} guess
* @return {string?}
*/
@@ -426,5 +437,6 @@ export function Internal() {
letterCounts,
anagramOfQuestions,
anagramOfQuestion,
+ alphagrammize,
};
}
diff --git a/djAerolith/wordwalls/templates/wordwalls/table.html b/djAerolith/wordwalls/templates/wordwalls/table.html
index 5f435d72..607de733 100644
--- a/djAerolith/wordwalls/templates/wordwalls/table.html
+++ b/djAerolith/wordwalls/templates/wordwalls/table.html
@@ -62,11 +62,12 @@
+ {% value_from_settings DEBUG as DEBUG %}
+
{% block content %}
+
+
+{% else %}
+ {% include "wordwalls_dynamic/wordwalls_include.html" %}
+{% endif %}