feat: Points for doing reviews
This commit is contained in:
@@ -33,7 +33,7 @@ interface IProps {
|
||||
levelId?: number;
|
||||
vocabByLevel?: (level: number) => Promise<IVocab[]>;
|
||||
vocabByQueue?: () => Promise<IVocab[]>;
|
||||
setLastReview: (meta: IReviewMetadata, sm2: any) => void;
|
||||
setLastReview: (meta: IReviewMetadata, sm2: any, delta: number) => void;
|
||||
reviewType: ReviewType;
|
||||
|
||||
history: any;
|
||||
@@ -65,6 +65,7 @@ const ReviewPageWithRouter = withRouter(
|
||||
private inputRef: HTMLInputElement;
|
||||
// Mapping: Vocab Id -> Correctly answered
|
||||
private sm2_metadata: any = {};
|
||||
private score_delta = 0;
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
@@ -189,13 +190,15 @@ const ReviewPageWithRouter = withRouter(
|
||||
// Check if the user's answer was correct
|
||||
if (minDist === 0) {
|
||||
this.updateGroupSM2(true);
|
||||
// TODO: Is this correct?
|
||||
this.score_delta += 1;
|
||||
|
||||
// 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.props.setLastReview(this.props.metadata, this.sm2_metadata, this.score_delta);
|
||||
this.props.setLoading(true);
|
||||
|
||||
// Show the drawer button again
|
||||
@@ -213,18 +216,9 @@ const ReviewPageWithRouter = withRouter(
|
||||
} else if (minDist <= LEVENSHTEIN_MAX_DISTANCE) {
|
||||
this.props.setPopover(true, "Das war fast richtig", "yellow", "black");
|
||||
} else {
|
||||
// Find the IVocab item
|
||||
/* const vocab = this.vocabFromId(this.props.current.id);
|
||||
* if (vocab) {
|
||||
* // Re-Add the vocabulary item to the review queue
|
||||
* // TODO: Only re-add when it when it's not re-queued
|
||||
* // vocabToReviewCard(vocab).forEach(this.reviewQueue.enqueue);
|
||||
* } else {
|
||||
* console.log("[ReviewPage::checkInput] Could not find IVocab item for wrong IReviewCard");
|
||||
* }
|
||||
*/
|
||||
// Update the metadata
|
||||
this.updateGroupSM2(false);
|
||||
this.score_delta -= 1;
|
||||
this.props.setReview(this.props.current, this.increaseMeta(0, 1));
|
||||
this.props.setPopover(true, "Das war nicht richtig", "red", "white");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user