Repository navigation
Conversation
b328c96 to
52a2ddd
Compare
drgrice1
left a comment
There was a problem hiding this comment.
I think it may be time to remove the "Open in new window" option from the PG editor. The code in Problem.pm for this is getting to be a mess. Furthermore, it is getting to be dangerous. If something is missed in development it could easily become the case that student data could modified when an instructor uses this when acting as a student. This is not even really a good feature of the PG problem editor. The problem can already be viewed by the instructor in the set after editing the problem. That is a much safer way for this to be done.
| my $showReturningFeedback = 0; | ||
|
|
||
| # Do not use answers/persistent data when editing a problem with a different seed. | ||
| my $useSavedData = !($c->{editMode} && $c->{seedChanged}); |
There was a problem hiding this comment.
I am not sure about this. The thing is that if a problem has been edited, the saved data might not be valid anymore even if the seed has not changed. The answers that are saved might not even match up with the questions the problem now has. So maybe the saved data should not be used at all when viewing a problem in edit mode.
There was a problem hiding this comment.
I think that is probably a reasonable approach. I don't use saved data so unsure if anyone would find it useful if trying to debug a problem or not.
There was a problem hiding this comment.
You say that you do not use saved data, but you do. Saved data here refers to the problem_data in addition to submitted answers. Everyone uses submitted answers.
| : $useSavedData ? () | ||
| : (problemData => '{}') |
There was a problem hiding this comment.
I don't like the repeated case from earlier in this massively nested ternary expression.
There was a problem hiding this comment.
I didn't either, but not repeating it required doing a test multiple times.
($prEnabled && !$problem->{prCount}) || (!$useSavedData && !defined $formFields->{problem_data})
? (problemData => '{}')
: ($can{checkAnswers} && defined $formFields->{problem_data})
? (problemData => $formFields->{problem_data})
: ()
Though a defined test is probably quick, I didn't think that cleared things up.
|
I'm okay with removing the new window feature altogether. Now that the preview window can be resized easily in the editor, it provides a nice way to view it at different window sizes so needing a new window isn't needed. And as you stated, once the problem is in a set, better to just view it in the instructor's set. I was just surprised when testing this with the seed changes that answers were included in the first place when editing a live problem. There is a rare use case I would have liked to know this was possible. I have been debugging a problem where a student did have an answer I wanted to be marked correct, so being able to use the student's answer vs typing it in each time could have been useful. But this is a very limited use case and probably not worth keeping this feature around. Typing in answers and checking them works just fine in the editor. |
|
This pull request is certainly needed. However, looking into this I see that there are a host of related issues with the |
0172825 to
3306146
Compare
|
I added a second commit that goes a lot further. This starts out by doing an early validity check/permission check with either I assumed that There were some existing bugs that I fixed. Some links to Undefined_Set were broken, and a TA who entered in a path to the Undefined_Set would get errors because they lack some permissions. Things not fixed here, but should be considered:
I have still opted to allow using the student's past answers if the problem seed matches. I think this has a rare use case when if trying to fix a bug in a problem using the student's answers vs having to type them in each time. If others think this is not worth allowing, this can be removed too. |
1ac1da6 to
0495096
Compare
|
I went another step further. checkSet was to liberal with allwoing |
2c45125 to
a9ab584
Compare
|
I went ahead and added |
a9ab584 to
6c557e8
Compare
|
The more that I look at this the more that I think the "Open in New Window" option for the problem editor needs to be removed. Furthermore, the "Try it" button for problems in the library browser needs to be removed. That is a feature that is no longer needed. It used to be the case that when problems were rendered in the library browser they were inert. There was not way to submit answers or actually work the problems. That is no longer the case, and the problems are fully functional directly in the library browser. So opening the problem in a new window to "try it" is no longer useful. |
drgrice1
left a comment
There was a problem hiding this comment.
Other than the permissions issue, the changes look good.
| my $allowUndefinedSet = | ||
| $setName eq 'Undefined_Set' | ||
| && (grep { $node_name eq $_ } qw(problem_detail gateway_quiz gateway_quiz_version)) | ||
| && $self->hasPermissions($userName, 'modify_problem_sets'); |
There was a problem hiding this comment.
This changes the permission for this. The permission used before was access_instructor_tools, not modify_problem_sets. I don't think that the modify_problem_sets permission is correct for this either. It should be changed back.
The problem editor requires both permissions and the library browser requires the modify_problem_sets permission. Usually someone with the modify_problem_sets permission will have the access_instructor_tools permission (it doesn't really make sense otherwise). This particular case does not give someone access to modify a set, and so it really should just be the lesser permission.
There was a problem hiding this comment.
This change was due to a possible issue Claude found with TA's who can access_instructor_tools but cannot modify_problem_sets. Without this change there was some extra logic needed in Problem.pm to deal with a TA getting a link to view an Undefined_Set. I will go look at this again, but I made this change to avoid the issue with extra checking for TAs and the modify_problem_sets permission, as I didn't see a use case where a TA should be able to view a problem in an Undefined_Set.
There was a problem hiding this comment.
I can change this back. I think we should check both access_instructor_tools and modify_problem_sets here (I used the assumption that modify_problem_sets permission would also include access_instructor_tools). Then modules that use the Undefined_Set no longer have to double check permissions, and the error message is more about the set does not exist, instead of a permissions error. Another option would be to add a message in invalidSet here that gets passed through about incorrect permissions.
The issue I ran into that cause me to change this was fixed by adding show_me_another to checkSet. Before that, the lower permissions would cause a crash in the show_me_another route as a TA and required extra handling. So the original reason for my change is no longer needed.
There was a problem hiding this comment.
I think it is moot. I think that #3271 is the way to go, and this pull request is not. That allows for the removal and clean up of a whole lot of code. There are now much better ways of doing things without all of that hackery.
744d935 to
9d3ae77
Compare
|
We are most likely going to #3271. Leaving this as a draft in case someone wants to advocate this approach. |
When viewing a problem in editMode (such as viewing a problem from the problem editor with the "Open in new window" checked) don't use the past answers from the effectiveUser if the seeds do not match. This prevents showing past answers if the seed is different, but past answers could be shown if the seeds match for debugging a problem. Hide the student navigation bar and problem grader when in editMode. It could be the wrong seed or even a temporary edit that hasn't been saved, and could be confusing to have the problem grader shown in this case. Prevent submitting/recording answers when in edit mode. This is to prevent submitting answers for wrong seeds for you or for students if that permission is configured. Always include the editMode hidden input when in editMode (not just for temporary files) so a check/preview/show correct form submit does not loose track of being in editMode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First, there is an initial test that requires editMode be set in combination with Undefined_Set along with testing permissions. Also reject invalid editMode settings. This makes it so using Undefined_Set in a url will fail with an invalid set unless editMode is set along with correct permissions. This also simplifies logic, so one only needs to test for editMode when deciding if to show/do something and not have to check the setID against Undefined_Set. In editMode, prevent submits, and other features such as show me another that could edit the database. Hide the nav bar completely, the siblings links, and other page features that are not useful when viewing/testing a problem edit in its own window. Hide buttons like "Show Me Another", "Show Past Answers", "Email Instructor", "Edit", "Edit Tags" buttons when in editMode. Fix a bunch of existing issues around use of Undefined_Set. A TA could try to view an Undefined_Set and get some bugs/crashes, breadcrumb links to an Undefined_Set caused a crash on the sets page (so don't include links in that case). Prevent a user from creating a set with ID Undefined_Set as this will not interact correctly with editMode. Update checkSet to only allow `Undefined_Set` for problem or test routes. This way there is no longer an error when trying to link to the ProblemSet `Undefined_Set`. Don't show the problem summary message in editMode (saved score, number of attempts used, number of attempts available, and so on). Only show the score of the recently checked answers when checking answers, so partial credit can be tested. Note this does hide any `state_summary_msg` created by custom macros/graders, so this isn't being tested. Add show_me_another to the checkSet test. This should have been done already, to avoid showing sets in show_me_another that have restrictions. This also simplifies tests in Problem.pm to ensure that both routes have already tested things with checkSet. Don't force show initial feedback after the answer date when in editMode. This didn't work well with Undefined_Set. Messages in editMode are still shown when editing a live problem (Such as this set is hidden/visible to students), but they are not shown when looking at an Undefined_Set. I'm unsure exactly what messages should be shown, but leaving these is probably still useful when viewing problems in a live set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9d3ae77 to
ddfb9ed
Compare
When viewing a problem in editMode (such as viewing a problem from the problem editor with the "Open in new window" checked) don't use the past answers from the effectiveUser if the seeds do not match. This prevents showing past answers if the seed is different, but past answers could be shown if the seeds match for debugging a problem.
Hide the student navigation bar and problem grader when in editMode. It could be the wrong seed or even a temporary edit that hasn't been saved, and could be confusing to have the problem grader shown in this case.
Prevent submitting/recording answers when in edit mode. This is to prevent submitting answers for wrong seeds for you or for students if that permission is configured.
Always include the editMode hidden input when in editMode (not just for temporary files) so a check/preview/show correct form submit does not loose track of being in editMode.
This fixes some issues I ran across when testing editing seeds while acting as users. Overall it felt that when viewing a problem in edit mode the above should be adjusted. It could be that I went too far, or more could be done when when viewing a problem in its own window while editing it.