From d08e591e27c57b8228dda4b16089e4915ce70c35 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Mon, 1 Oct 2018 19:02:12 +0200 Subject: [PATCH] fix: Was ist Prozentrechnung? --- frontend/src/pages/review.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/review.tsx b/frontend/src/pages/review.tsx index dcf3292..a6671f6 100644 --- a/frontend/src/pages/review.tsx +++ b/frontend/src/pages/review.tsx @@ -252,11 +252,19 @@ const ReviewPageWithRouter = withRouter( ; } - const { question, qtype } = this.props.current; const questionTitle = `${question} (${reviewQTypeToStr(qtype)})`; - // TODO: - const progress = 50; + // TODO/NOTE: This assumes that each vocabulary item gets mapped to + // exactly 3 review cards + // NOTE: The 'numCards === 0 ?' is neccessary as (for some reasdn) numCards + // starts of by being 0, which results in progress === -Inifinity. + // That looks weird as the user sees the progressbar jump. + const numCards = this.vocab.length * 3; + const progress = numCards === 0 ? ( + 0 + ) : ( + 100 * (numCards - (this.reviewQueue.size() + 1)) / numCards + ); return