Skip to content

Persist attempts used across sessions#41

Closed
abocha wants to merge 1 commit into
mainfrom
codex/add-attempts-used-tracking-to-storage-pdcwwi
Closed

Persist attempts used across sessions#41
abocha wants to merge 1 commit into
mainfrom
codex/add-attempts-used-tracking-to-storage-pdcwwi

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
Comment on lines 55 to 61
setStudentName(savedName);
const storageKey = `ss::${assignment.id}::${savedName}`;
const savedProgress = loadProgress(storageKey);
setAttemptsUsed(savedProgress?.attemptsUsed ?? 0);
if (savedProgress && savedProgress.results.length > 0) {
setProgress(savedProgress);
setShowResumePrompt(true);

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] Preserve attempts when progress has no results

The initialization effect loads savedProgress and restores attemptsUsed, but it immediately calls startNewAttempt() whenever savedProgress.results.length === 0. startNewAttempt overwrites the saved data and resets attemptsUsed back to 0 in both state and localStorage. If a student closes the page after using some attempts on the first sentence (before any results are recorded), reopening the homework resets the remaining attempts instead of enforcing the persisted limit. Consider skipping startNewAttempt when a saved record exists or at least avoiding the reset when attemptsUsed > 0 so the max-attempt limit is still honored across sessions.

Useful? React with 👍 / 👎.

@abocha abocha closed this Sep 15, 2025
@abocha
abocha deleted the codex/add-attempts-used-tracking-to-storage-pdcwwi 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