Now using important_reading data to determine kana answer for kanji.

This commit is contained in:
neviyn 2016-01-25 16:48:41 +00:00
parent 32bae249db
commit f743358355

View File

@ -113,12 +113,6 @@ def parse_range(input_range):
return result
def combine_onyomi_and_kunyomi(onyomi, kunyomi):
if onyomi and kunyomi:
return onyomi + ',' + kunyomi.replace('.*', '')
return onyomi if onyomi else kunyomi.replace('.*', '')
def get_items_with_level_restriction(level_range, item_state, item_types):
items = []
radical_count = 0
@ -134,7 +128,7 @@ def get_items_with_level_restriction(level_range, item_state, item_types):
for item in filter((lambda x: x['user_specific'] and x['user_specific']['srs'] in item_state
and x['level'] in level_range), loads(current_user.kanji)):
items.extend([{'item_type': 'kanji', 'question': item['character'],
'answer': combine_onyomi_and_kunyomi(item['onyomi'], item['kunyomi']),
'answer': item['onyomi'] if item['important_reading'] == 'onyomi' else item['kunyomi'],
'answer_type': 'kana'},
{'item_type': 'kanji', 'question': item['character'], 'answer': item['meaning'],
'answer_type': 'eng'}])