From 634454edb6092262ee96c148a9f7ee76373d255a Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 5 Oct 2015 16:48:29 +0100 Subject: [PATCH] Added stats for how many potential review items there are. --- static/quiz_item.coffee | 7 +++++++ templates/quiz.html | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index a0f8ae4..1d4f27a 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -5,7 +5,14 @@ refreshQuestion = () -> dataType: 'json', success: (e) -> sessionStorage.setItem('user_items', JSON.stringify(e['item_list'])) + sessionStorage.setItem('radical_count', e['radical_count']) + sessionStorage.setItem('kanji_count', e['kanji_count']) + sessionStorage.setItem('vocabulary_count', e['vocabulary_count']) refreshQuestion() + if($('#radical-num').text() == '') + $('#radical-num').text(sessionStorage.getItem('radical_count')); + $('#kanji-num').text(sessionStorage.getItem('kanji_count')); + $('#vocab-num').text(sessionStorage.getItem('vocabulary_count')); if(sessionStorage.getItem('user_items')) items = JSON.parse(sessionStorage.getItem('user_items')) selection = items[Math.floor(Math.random() * items.length)] diff --git a/templates/quiz.html b/templates/quiz.html index c3301e9..b3244f2 100644 --- a/templates/quiz.html +++ b/templates/quiz.html @@ -8,6 +8,14 @@