Skip to content

Commit

Permalink
Update Problem.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyabhandari0220 authored Feb 6, 2024
1 parent 3315deb commit 672f16d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/problem-layout/Problem.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Problem extends React.Component {

this.state = {
stepStates: {},
firstAttempts: {},
problemFinished: false,
showFeedback: false,
feedback: "",
Expand Down Expand Up @@ -212,7 +213,7 @@ class Problem extends React.Component {
};

answerMade = (cardIndex, kcArray, isCorrect) => {
const { stepStates } = this.state;
const { stepStates, firstAttempts } = this.state;
const { lesson, problem } = this.props;

console.debug(`answer made and is correct: ${isCorrect}`);
Expand Down Expand Up @@ -240,7 +241,8 @@ class Problem extends React.Component {
);
continue;
}
if (this.doMasteryUpdate) {
if (this.doMasteryUpdate && (firstAttempts[cardIndex] === undefined || firstAttempts[cardIndex] === false)) {
firstAttempts[cardIndex] = true;
update(this.bktParams[kc], isCorrect);
}
}
Expand Down Expand Up @@ -325,6 +327,7 @@ class Problem extends React.Component {

this.setState({
stepStates: {},
firstAttempts: {},
problemFinished: false,
feedback: "",
feedbackSubmitted: false,
Expand Down

0 comments on commit 672f16d

Please sign in to comment.