Skip to content

Periodically autosave answers on timed gateway tests#3059

Open
xcompass wants to merge 1 commit into
openwebwork:developfrom
ubc:upstream-gateway-autosave
Open

Periodically autosave answers on timed gateway tests#3059
xcompass wants to merge 1 commit into
openwebwork:developfrom
ubc:upstream-gateway-autosave

Conversation

@xcompass

@xcompass xcompass commented Jul 13, 2026

Copy link
Copy Markdown
Member

Periodically submit the gwquiz form in the background as a preview request on timed gateway tests, so the server saves the student's latest answers and work is not lost to a crash or dropped connection.

Per review: disabled by default. Set $gatewayAutosaveInterval (seconds) in the course environment to enable and control the period. Saves are skipped when answers have not changed since the last save, and the interval is randomized upward by up to a third to stagger load. Not active when an instructor acts as another user.

No server code changes; the preview pipeline already stores last answers.

@drgrice1 drgrice1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not the right way to do this. Submitting a test already causes a lot of server overhead, and so making a test preview auto submit on a regular basis is really not going to work. Particularly with no option to disable it, and no options to set the period or anything.

This will need more thought and better development. In any case, this is certainly something that will need to wait until the next release. Please re-target to the develop branch.

@xcompass xcompass changed the base branch from WeBWorK-2.21 to develop July 14, 2026 01:59
@xcompass

Copy link
Copy Markdown
Member Author

Changed target to develop. Happy to discuss it further. I'll add an option and have it disabled by default.

@xcompass xcompass force-pushed the upstream-gateway-autosave branch from e28c93c to fdb389b Compare July 14, 2026 07:14
Submit the gwquiz form in the background as a preview request so the
server saves the last answers, protecting students on timed tests from
losing work to a crash or dropped connection. Disabled by default;
enabled by setting $gatewayAutosaveInterval (seconds) in the course
environment. Saves are skipped when the answers have not changed and
when an instructor is acting as another user.
@xcompass xcompass force-pushed the upstream-gateway-autosave branch from fdb389b to 2cc3c59 Compare July 14, 2026 07:22
@xcompass

Copy link
Copy Markdown
Member Author

Added the option: $gatewayAutosaveInterval in defaults.config, in seconds, 0/off by default — nothing renders and no timer is started unless a site or course sets it. The period is fully configurable through it, and saves only happen when answers actually changed. Also rebased onto develop as requested.

@dlglin

dlglin commented Jul 14, 2026

Copy link
Copy Markdown
Member

There have been many discussions about how to improve the capture of student answers if they don't submit the exam (including #1156).

At this point having one question per page has almost entirely solved the issue for me since answers are saved when a student navigates between pages. Historically this caused other problems because students would submit the entire exam after answering the first question, but there are now multiple features that have reduced that to a very rare occurrence; namely the popup that appears warning students of this, and in the 2.21 release the "previous page/next page" buttons that are more prominent than the "Grade Test" button.

Here are a couple of alternative ideas for saving answers:

  1. Have a "save answer(s)" button next to each question. The easy way to implement this would be to just have this button trigger an answer preview since that saves the student's answers.
  2. Set up a javascript trigger that saves an answer as soon as a student navigates out of an answer blank. This would be complicated to implement since there are things like multianswer to account for, and it leads to similar load issues to what @drgrice1 described. I'm also not convinced that it would provide much more benefit than one question per page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants