From c61cd505af6bb2133748fe9e3786ee8ac7404ae2 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Wed, 23 Dec 2015 23:40:33 +0000 Subject: [PATCH] Fixed count responses being floats instead of ints, changed wording in response to better reflect content. --- static/quiz_item.coffee | 2 +- static/quiz_item.js | 2 +- wanikaniburned.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index df9c60d..253f01c 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -23,7 +23,7 @@ refreshQuestion = () -> else document.body.style.backgroundColor = "darkviolet"; $("#question-area").text(selection['question']); - if(selection['answer_type'] == 'romaji') + if(selection['answer_type'] == 'eng') $("#kana").attr("placeholder", "Meaning") wanakana.unbind(input_element); else diff --git a/static/quiz_item.js b/static/quiz_item.js index fbf2b26..c8effc1 100644 --- a/static/quiz_item.js +++ b/static/quiz_item.js @@ -30,7 +30,7 @@ document.body.style.backgroundColor = "darkviolet"; } $("#question-area").text(selection['question']); - if (selection['answer_type'] === 'romaji') { + if (selection['answer_type'] === 'eng') { $("#kana").attr("placeholder", "Meaning"); return wanakana.unbind(input_element); } else { diff --git a/wanikaniburned.py b/wanikaniburned.py index 310a927..a123c8a 100644 --- a/wanikaniburned.py +++ b/wanikaniburned.py @@ -130,8 +130,8 @@ def get_items_with_level_restriction(level_range, item_state, item_types): 'answer': combine_onyomi_and_kunyomi(item['onyomi'], item['kunyomi']), 'answer_type': 'kana'}, {'item_type': 'kanji', 'question': item['character'], 'answer': item['meaning'], - 'answer_type': 'romaji'}]) - kanji_count = (len(items) - radical_count) / 2 + 'answer_type': 'eng'}]) + kanji_count = int((len(items) - radical_count) / 2) vocabulary_count = 0 if 'vocab' in item_types: for item in filter((lambda x: x['user_specific'] and x['user_specific']['srs'] in item_state @@ -139,8 +139,8 @@ def get_items_with_level_restriction(level_range, item_state, item_types): items.extend([{'item_type': 'vocabulary', 'question': item['character'], 'answer': item['kana'], 'answer_type': 'kana'}, {'item_type': 'vocabulary', 'question': item['character'], - 'answer': item['meaning'], 'answer_type': 'romaji'}]) - vocabulary_count = (len(items) - (radical_count + kanji_count)) / 2 + 'answer': item['meaning'], 'answer_type': 'eng'}]) + vocabulary_count = int((len(items) - (radical_count + kanji_count)) / 2) if not items: return flask.jsonify(error="No items within these filter parameters") else: