Skip to content

Prevent adding, deleting, or reordering test problems once students have begun working the test. - #3246

Open
drgrice1 wants to merge 2 commits into
openwebwork:developfrom
drgrice1:test-lock-once-worked
Open

drgrice1 wants to merge 2 commits into
openwebwork:developfrom
drgrice1:test-lock-once-worked

Conversation

@drgrice1

Copy link
Copy Markdown
Member

Existing test versions are not updated when problems are added, deleted, or reordered for a test, and that leaves those versions inconsistent with the set (see issues #1513 and #3234). Furthermore, updating student versions would change their test results. Now once users other than the current user have versions of a test, the controls for adding, deleting, and reordering problems are hidden on the set detail page and a notice is shown explaining why. Those changes are also rejected server side by the set detail page, by the problem editor's add to set actions, and by the addProblem and deleteProblem API commands. Changing the assignment type of such a set to or from jitar is also rejected since that renumbers the problems.

If the only versions of a test are those of the current user (e.g., an instructor working on creating the test), then these changes are allowed and the current user's versions are updated accordingly. Problems added to a set are now also added to existing versions of the set, deleting a problem now also deletes the corresponding problem versions, and reordering problems on the set detail page also reorders the problem versions.

The reorderProblems API command does not update user problems or problem versions, so it is rejected if any versions of the test exist.

The set detail help now has an "Editing Tests" entry that describes these restrictions and the quirks that can occur when an instructor edits a test they have already taken. In particular, answers previously entered in those versions are no longer shown with a problem whose number changes, since the answer names are prefixed with the problem number.

This is intended to address #3234 and #1513.

@pstaabp pstaabp 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.

Looks good.

@somiaj

somiaj commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

I haven't fully tested this, but you mention you prevent changing to a JITAR set, but what happens to test versions if you change to a default homework set? I see that the set editor still detects versions exist and keeps one from deleting or changing problems, but the set versions are no longer accessible to students.

Maybe restrict changing sets to default assignments as well (only allow toggling between tests and proctored tests).

Would it also be useful to remove JITAR (and homework if you decided to restrict that too) from the list of assignment types so it is clearer it cannot be selected (or disabling it?) Though if the logic is a bit difficult here, might not be worth it.

@drgrice1

Copy link
Copy Markdown
Member Author

The reasoning behind not allowing the switch to JITAR sets is that immediately renumbers problems (JITAR sets use a completely different numbering system). Switching to a default set does not cause that problem. Furthermore, once that switch is made the set is still restricted from adding, deleting, or reordering problems even though it is not a test anymore, since the only criterion for the restriction is that versioned sets exist, and they still do. Students cannot access those versions, but if the assignment is switched back to a test, then those versions are still there and still work. So that restriction is not needed.

@drgrice1
drgrice1 force-pushed the test-lock-once-worked branch from 9f27d54 to 0c12a0f Compare October 20, 2026 21:35
…ave begun working the test.

Existing test versions are not updated when problems are added, deleted,
or reordered for a test, and that leaves those versions inconsistent
with the set (see issues openwebwork#1513 and openwebwork#3234). Furthermore, updating student
versions would change their test results. Now once users other than the
current user have versions of a test, the controls for adding, deleting,
and reordering problems are hidden on the set detail page and a notice
is shown explaining why. Those changes are also rejected server side by
the set detail page, by the problem editor's add to set actions, and by
the addProblem and deleteProblem API commands.  Changing the assignment
type of such a set to or from jitar is also prevented since that
renumbers the problems.  The "Just in Time Assessment and Review" option
in the assignment type select is disabled, and the change is also
rejected server side.

If the only versions of a test are those of the current user (e.g., an
instructor working on creating the test), then these changes are allowed
and the current user's versions are updated accordingly.  Problems added
to a set are now also added to existing versions of the set, deleting a
problem now also deletes the corresponding problem versions, and
reordering problems on the set detail page also reorders the problem
versions.

The reorderProblems API command does not update user problems or problem
versions, so it is rejected if any versions of the test exist.

The set detail help now has an "Editing Tests" entry that describes
these restrictions and the quirks that can occur when an instructor
edits a test they have already taken. In particular, answers previously
entered in those versions are no longer shown with a problem whose
number changes, since the answer names are prefixed with the problem
number.

This is intended to address openwebwork#3234 and openwebwork#1513.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drgrice1
drgrice1 force-pushed the test-lock-once-worked branch from 0c12a0f to 5a971b7 Compare October 20, 2026 22:54
…ing a test.

Previously only changing the assignment type to jitar was prevented once
students had begun working a test. Changing a test to a homework set
also causes problems. The test versions become inaccessible to students,
grading (including LTI grade passback) switches to the user problems
which are not used for tests, and work done on those user problems leaks
into the test versions if the set is later changed back to a test, since
the merged problem versions fall back to the user problems for fields
that are not set in the version.

So now once students have begun working a test, the assignment type can
only be changed between "Test" and "Proctored Test". The other options
in the assignment type select are disabled, the change is rejected
server side, and the set detail help is updated to explain this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drgrice1

Copy link
Copy Markdown
Member Author

This now does not allow switching a test that students have started to work to homework or JITAR. Those assignment types are disabled in the select, and the changes are rejected server side. So the only allowed changes to an in progress test assignment type are between proctored or not.

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