Handle case where no test groups are runnable by instructors #7038
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR achieves the same task as PR#7003 but for instructors.
In the autotest-settings page (in the instructor view), the instructor has the ability to make all test groups NOT-runnable by students. Currently, when an instructor presses the "Run Tests" button, a request is still sent to the auto-testing server and 0/0 is shown on the front-end. We want to change this so that, if no test-groups are instructor-runnable, when instructor presses "Run Tests" we avoid the unnecessary request to the autotest server and present an appropriate message on the screen.
Note that there are two ways for an instructor to attempt to run tests - both in the
Submissions
tab.The first one is from the submissions tab itself, where you can select arbitrary students (and groups) and run tests for them. This is handled by the
run_tests
action in thesubmissions_controller
.The other one is by following the link to a particular student (in the
Submissions
tab, each row in the table includes a link titled as the student's utorid). This is handled by therun_tests
action in theresults_controller
.Your Changes
Description:
An
Assignment
object has atest_groups
association (corresponding to atest_groups
table in the postgres database) holding information about the autotest-settings set by the instructor for that assignment, including who can run the tests, which is an array equal to one of the four following:["instructor", "student"]
,["instructor"]
,["student"]
,[]
.In the
run_tests
actions of thesubmissions_controller
and theresults_controller
we examine thetest_groups
attribute of the current assignment and if there is no test-group runnable by an instructor, we flash an appropriate message and return early.Type of change (select all that apply):
Testing
Parallels the testing exhibited in PR#7003; in this case with the files corresponding to the submissions_controller and the results_controller.
Questions and Comments (if applicable)
Checklist