Skip to content

Persist attempts used across sessions#42

Closed
abocha wants to merge 3 commits into
mainfrom
codex/add-attempts-used-tracking-to-storage-3c8cfb
Closed

Persist attempts used across sessions#42
abocha wants to merge 3 commits into
mainfrom
codex/add-attempts-used-tracking-to-storage-3c8cfb

Conversation

@abocha

@abocha abocha commented Sep 15, 2025

Copy link
Copy Markdown
Owner

Summary

  • Track attempts used for the active homework item and reset after completion
  • Persist and restore attemptsUsed in localStorage to honor remaining tries
  • Enforce max-attempt limits with optional auto-reveal when the limit is reached

Testing

  • npm test
  • npm run build

https://chatgpt.com/codex/tasks/task_e_68c821dac704832cbdd17782430440e7

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment thread components/GameApp.tsx Outdated
Comment on lines 317 to 340
if (mode === 'homework') {
updateProgress({ index: currentSentenceIndex, ok: isCorrect, revealed: false });
if (isCorrect) {
updateProgress({ index: currentSentenceIndex, ok: true, revealed: false });
} else {
const newAttempts = attemptsUsed + 1;
setAttemptsUsed(newAttempts);
if (progress && assignment) {
const storageKey = `ss::${assignment.id}::${studentName}`;
const newProgress = { ...progress, attemptsUsed: newAttempts };
setProgress(newProgress);
saveProgress(storageKey, newProgress);
}
if (attemptsLimit !== null && newAttempts >= attemptsLimit) {
if (assignment?.options.revealAnswerAfterMaxAttempts) {
handleReveal();
return;
} else {
updateProgress({ index: currentSentenceIndex, ok: false, revealed: false });
}
}
}
}

setFeedback({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Record progress before showing Next after wrong attempt

When a homework item is answered incorrectly but the maximum attempts has not been reached, handleCheckAnswer increments attemptsUsed but never calls updateProgress. Despite that, the code still sets feedback, which switches the UI to the "Next" button. This lets a student advance to the next sentence without a Result being appended for the current one and without resetting the attempt counter, so progress summaries and the final results modal can miss sentences or carry attempts into subsequent items. Consider preventing navigation until a Result is recorded or resetting attempts when moving on.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fix comments

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Added a shouldShowFeedback flag to delay displaying the Next button until progress is recorded, preventing students from advancing after an incorrect answer without logging a result components/GameApp.tsxL305-L350

Testing

  • npm test
  • npm run build

View task →

@abocha abocha closed this Sep 17, 2025
@abocha
abocha deleted the codex/add-attempts-used-tracking-to-storage-3c8cfb branch September 17, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant