diff --git a/example-config.py b/example-config.py index 38a24b3..ad11089 100644 --- a/example-config.py +++ b/example-config.py @@ -2,3 +2,5 @@ # Change as required. SQLALCHEMY_DATABASE_URI = 'sqlite:///wanikani.db' SECRET_KEY = "putabettersecretkeyhere" +DEBUG = False +SERVER_NAME = '127.0.0.1:5000' \ No newline at end of file diff --git a/wanikaniburned.py b/wanikaniburned.py index 6c52d04..9d029c7 100644 --- a/wanikaniburned.py +++ b/wanikaniburned.py @@ -143,12 +143,16 @@ def show_quiz(): @login_required def get_items(): items = [] + radical_count = 0 for item in json.loads(current_user.radicals): + radical_count += 1 if item['image']: items.append({'item_type': 'radical', 'question': item['image'], 'answer': item['meaning']}) else: items.append({'item_type': 'radical', 'question': item['character'], 'answer': item['meaning']}) + kanji_count = 0 for item in json.loads(current_user.kanji): + kanji_count += 1 made_answer = "" if item['onyomi'] and item['kunyomi']: made_answer = item['onyomi'] + ',' + item['kunyomi'].replace('.*', '') @@ -158,10 +162,13 @@ def get_items(): made_answer = item['kunyomi'].replace('.*', '') items.append({'item_type': 'kanji', 'question': item['character'], 'answer': made_answer, 'answer_meaning': item['meaning']}) + vocabulary_count = 0 for item in json.loads(current_user.vocabulary): + vocabulary_count += 1 items.append({'item_type': 'vocabulary', 'question': item['character'], 'answer': item['kana'], 'answer_meaning': item['meaning']}) - return jsonify(item_list=items) + return jsonify(radical_count=radical_count, kanji_count=kanji_count, vocabulary_count=vocabulary_count, + item_list=items) @app.route('/refresh', methods=['POST']) @@ -182,5 +189,4 @@ def unauthorized(): if __name__ == '__main__': db.create_all() - app.debug = True - app.run() + app.run(threaded=True)