Fixed count responses being floats instead of ints, changed wording in response to better reflect content.

This commit is contained in:
neviyn 2015-12-23 23:40:33 +00:00
parent 8b170c3264
commit c61cd505af
3 changed files with 6 additions and 6 deletions

View File

@ -23,7 +23,7 @@ refreshQuestion = () ->
else else
document.body.style.backgroundColor = "darkviolet"; document.body.style.backgroundColor = "darkviolet";
$("#question-area").text(selection['question']); $("#question-area").text(selection['question']);
if(selection['answer_type'] == 'romaji') if(selection['answer_type'] == 'eng')
$("#kana").attr("placeholder", "Meaning") $("#kana").attr("placeholder", "Meaning")
wanakana.unbind(input_element); wanakana.unbind(input_element);
else else

View File

@ -30,7 +30,7 @@
document.body.style.backgroundColor = "darkviolet"; document.body.style.backgroundColor = "darkviolet";
} }
$("#question-area").text(selection['question']); $("#question-area").text(selection['question']);
if (selection['answer_type'] === 'romaji') { if (selection['answer_type'] === 'eng') {
$("#kana").attr("placeholder", "Meaning"); $("#kana").attr("placeholder", "Meaning");
return wanakana.unbind(input_element); return wanakana.unbind(input_element);
} else { } else {

View File

@ -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': combine_onyomi_and_kunyomi(item['onyomi'], item['kunyomi']),
'answer_type': 'kana'}, 'answer_type': 'kana'},
{'item_type': 'kanji', 'question': item['character'], 'answer': item['meaning'], {'item_type': 'kanji', 'question': item['character'], 'answer': item['meaning'],
'answer_type': 'romaji'}]) 'answer_type': 'eng'}])
kanji_count = (len(items) - radical_count) / 2 kanji_count = int((len(items) - radical_count) / 2)
vocabulary_count = 0 vocabulary_count = 0
if 'vocab' in item_types: if 'vocab' in item_types:
for item in filter((lambda x: x['user_specific'] and x['user_specific']['srs'] in item_state 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'], items.extend([{'item_type': 'vocabulary', 'question': item['character'], 'answer': item['kana'],
'answer_type': 'kana'}, 'answer_type': 'kana'},
{'item_type': 'vocabulary', 'question': item['character'], {'item_type': 'vocabulary', 'question': item['character'],
'answer': item['meaning'], 'answer_type': 'romaji'}]) 'answer': item['meaning'], 'answer_type': 'eng'}])
vocabulary_count = (len(items) - (radical_count + kanji_count)) / 2 vocabulary_count = int((len(items) - (radical_count + kanji_count)) / 2)
if not items: if not items:
return flask.jsonify(error="No items within these filter parameters") return flask.jsonify(error="No items within these filter parameters")
else: else: