From 2276dad7a7e9fc2a791921b33f72ea67a890c448 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Sun, 30 Sep 2018 13:48:20 +0200 Subject: [PATCH] fix: Fix the level page handling vocab IDs wrongly --- frontend/src/pages/level.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/level.tsx b/frontend/src/pages/level.tsx index c6087fb..f85f94b 100644 --- a/frontend/src/pages/level.tsx +++ b/frontend/src/pages/level.tsx @@ -50,6 +50,7 @@ const LevelPageWithRouter = withRouter( this.props.levelVocab(this.props.id).then(vocab => { this.props.setVocab(vocab); this.props.setCurrentVocab(vocab[0]); + this.props.setLookedAt([vocab[0].id]); this.props.setLoading(false); }); @@ -68,7 +69,7 @@ const LevelPageWithRouter = withRouter( renderVocabListItem = (vocab: IVocab): any => { // Check if the vocab was already looked at - const lookedAt = this.props.lookedAt.find((el) => el === vocab.id) || vocab.id === 0; + const lookedAt = this.props.lookedAt.find((el) => el === vocab.id); return { // Prevent the user from using too much memory by always clicking on the elements @@ -87,6 +88,9 @@ const LevelPageWithRouter = withRouter( toReview = () => { const { vocab, lookedAt, id } = this.props; + + console.log(this.props); + // Only go to the review if all vocabulary item have been looked at if (vocab.length === lookedAt.length) { this.props.updateDoneLevels(id);