Updated response logic to filter only burned items now that database includes non-burned items.

This commit is contained in:
neviyn 2015-10-11 22:46:07 +01:00
parent 3a5811cafd
commit ff19b0e6b9

View File

@ -134,6 +134,7 @@ def get_items():
items = []
radical_count = 0
for item in json.loads(current_user.radicals):
if item['user_specific'] and item['user_specific']['burned']:
radical_count += 1
if item['image']:
items.append({'item_type': 'radical', 'question': item['image'], 'answer': item['meaning']})
@ -143,6 +144,7 @@ def get_items():
for item in json.loads(current_user.kanji):
kanji_count += 1
made_answer = ""
if item['user_specific'] and item['user_specific']['burned']:
if item['onyomi'] and item['kunyomi']:
made_answer = item['onyomi'] + ',' + item['kunyomi'].replace('.*', '')
elif item['onyomi']:
@ -153,6 +155,7 @@ def get_items():
'answer_meaning': item['meaning']})
vocabulary_count = 0
for item in json.loads(current_user.vocabulary):
if item['user_specific'] and item['user_specific']['burned']:
vocabulary_count += 1
items.append({'item_type': 'vocabulary', 'question': item['character'], 'answer': item['kana'],
'answer_meaning': item['meaning']})