fix: The metadata not being updated on the last item

This commit is contained in:
Alexander Polynomdivision 2018-10-02 12:42:59 +02:00
parent 4ac1a5dad4
commit 91dbe0c4b7

View File

@ -190,15 +190,19 @@ const ReviewPageWithRouter = withRouter(
// Check if the user's answer was correct
if (minDist === 0) {
this.updateGroupSM2(true);
// TODO: Is this correct?
// TODO: Is this the correct amount of points?
this.score_delta += 1;
// Empty the input field
this.inputRef.value = "";
// TODO: Show it's correct?
// Show the next vocab word
if (this.reviewQueue.size() === 0) {
// Update the metadata
this.props.setReview(this.props.current, this.increaseMeta(1, 0));
this.props.setLastReview(this.props.metadata, this.sm2_metadata, this.score_delta);
const newMeta = this.increaseMeta(1, 0);
this.props.setReview(this.props.current, newMeta);
this.props.setLastReview(newMeta, this.sm2_metadata, this.score_delta);
this.props.setLoading(true);
// Show the drawer button again
@ -207,11 +211,8 @@ const ReviewPageWithRouter = withRouter(
// Go to the summary screen
this.props.history.push("/review/summary");
} else {
// Increase the vocab
// Update the metadata
this.props.setReview(this.reviewQueue.dequeue(), this.increaseMeta(1, 0));
this.inputRef.value = "";
// TODO(?): Show a snackbar for showing the updated score
}
} else if (minDist <= LEVENSHTEIN_MAX_DISTANCE) {
this.props.setPopover(true, "Das war fast richtig", "yellow", "black");