-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip submissions if any have been graded in next submitter view #1199
Skip submissions if any have been graded in next submitter view #1199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the query for the latest submissions of each submitter is still not working correctly.
Remember also that a submission may have multiple submitters and those cases should also be tested. The current unit tests use too few submissions and different submitters to reveal significant bugs.
I am pushing a new commit that fixes minor issues in the current unit tests.
@@ -1428,7 +1431,19 @@ def get_url_user_id(args=''): | |||
# an even earlier submission in another exercise doesn't matter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few lines above, user2_other_exercise_submission
is actually submitted by self.user
and not self.user2
.
exercise/tests.py
Outdated
# grading in an older submission (not latest) should also mean user1 is skipped | ||
user_earlier_submission.grader = None | ||
user_earlier_submission.save() | ||
user_submission.grader = self.teacher.userprofile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says grading in an older submission (not latest) should also mean user1 is skipped
, but aren't you grading the latest submission right here?
exercise/staff_views.py
Outdated
@@ -329,6 +329,8 @@ def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: | |||
# submissions for this exercise | |||
submissions = Submission.objects.filter(exercise=self.exercise) | |||
|
|||
submitters_with_grading = submissions.exclude(grader=None).values_list('submitters__id', flat=True) | |||
|
|||
# filter only the latest submissions | |||
submissions = (submissions.annotate(latest=Max('submission_time')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the annotate
call for the latest
submissions is working correctly. It doesn't seem to find the latest submission for each submitter separately.
3faa9c6
to
137241d
Compare
I looked at the SQL query produced by the "submissions annotate latest` statement. (submissions.annotate(latest=Max('submission_time'))
.filter(submission_time=F('latest'))
.order_by('latest'))) This GROUP BY part looks suspicious since it is not grouping by submitters. See the whole query below. GROUP BY "exercise_submission"."id"
HAVING "exercise_submission"."submission_time" = MAX("exercise_submission"."submission_time") The whole SQL query: SELECT "exercise_submission"."id",
"exercise_submission"."submission_time",
"exercise_submission"."hash",
"exercise_submission"."exercise_id",
"exercise_submission"."grader_id",
"exercise_submission"."feedback",
"exercise_submission"."assistant_feedback",
"exercise_submission"."status",
"exercise_submission"."grade",
"exercise_submission"."grading_time",
"exercise_submission"."late_penalty_applied",
"exercise_submission"."force_exercise_points",
"exercise_submission"."service_points",
"exercise_submission"."service_max_points",
"exercise_submission"."submission_data",
"exercise_submission"."grading_data",
"exercise_submission"."meta_data",
MAX("exercise_submission"."submission_time") AS "latest"
FROM "exercise_submission"
INNER JOIN "exercise_submission_submitters"
ON ("exercise_submission"."id" = "exercise_submission_submitters"."submission_id")
WHERE ("exercise_submission"."exercise_id" = 61 AND "exercise_submission_submitters"."userprofile_id" = 7)
GROUP BY "exercise_submission"."id"
HAVING "exercise_submission"."submission_time" = MAX("exercise_submission"."submission_time")
ORDER BY "latest" ASC I think the part for querying a single user ( previous_submission_time = submissions.filter(submitters__id=previous_user_id).first().submission_time |
This reverts commit 0a5d7f5. The feature for chronological sorting of the submissions in the `NextUnassessedSubmitterView` is still not working correctly. Thus, I revert this commit before making a new stable release. See issues apluslms#1196 and apluslms#1110 and pull requests apluslms#1199 and apluslms#1167.
I decided to try to try reimplement it by making small changes to the original query and managed to create a query which seems to provide the correct behavior for multiple users, and seems to group users based on their profile and sort them based on their earliest submission
|
a645825
to
a87567a
Compare
6e4d3df
to
9fe9551
Compare
9fe9551
to
83459cf
Compare
Fixes #1196
Description
What?
Submitters whose older work was already graded weren't skipped when pressing the "next submitter" link in manual assesment.
Why?
We shouldn't show a user whose work has already been graded even if they have later work.
How?
Rather than checking if the most recent submission has been graded, we skip submitters based on if any of their submissions for this exercise has been graded
Fixes #1196
Testing
What type of test did you run?
In addition to unit tests I ensured that after grading the latest assesment the next submitter link takes you correctly. I also manually added a grader to the older work of the first user and ensured that this user was skipped even if their latest submission wasn't graded.
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!