Skip to content
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

Sort unassessed exercises by most recent submission #1167

Merged

Conversation

EerikSaksi
Copy link
Contributor

Fixes #1110

Description

What?

Sort unassessed submissions by time when manually assessing submissions

Why?

Teachers can start grading the earliest submissions before all have been submitted

How?
Sort submissions by submission time, and if the prev URL param exists, then get the next submission after prev

Fixes #1110

Testing

Remember to add or update unit tests for new features and changes.

What type of test did you run?

  • Accessibility test using the WAVE extension.
  • Django unit tests.
  • Selenium tests.
  • Other test. (Add a description below)
  • Manual testing.

Manually ensured that sorted by submission time, and order changes as submission time is changed in the database and newer submissions are added.

Did you test the changes in

  • Chrome
  • Firefox
  • This pull request cannot be tested in the browser.

Think of what is affected by these changes and could become broken

Translation

Programming style

  • Did you follow our style guides?
  • Did you use Python type hinting in all functions that you added or edited? (type hints for function parameters and return values)

Have you updated the README or other relevant documentation?

  • documents inside the doc directory.
  • README.md.
  • Aplus Manual.
  • Other documentation (mention below which documentation).

Is it Done?

  • Reviewer has finished the code review
  • After the review, the developer has made changes accordingly
  • Customer/Teacher has accepted the implementation of the feature

Clean up your git commit history before submitting the pull request!

@EerikSaksi EerikSaksi mentioned this pull request Mar 22, 2023
18 tasks
@ihalaij1 ihalaij1 self-requested a review April 11, 2023 10:55
Copy link
Contributor

@ihalaij1 ihalaij1 left a comment

Choose a reason for hiding this comment

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

I found bug in the code, see if you can fix it and I'll test the code again. A unittest should be created that tests the scenario that I described in the comment.

exercise/staff_views.py Show resolved Hide resolved
@EerikSaksi EerikSaksi force-pushed the chronological-next-submission branch from 99c0ba9 to a6e5972 Compare May 9, 2023 10:58
Copy link
Contributor

@ihalaij1 ihalaij1 left a comment

Choose a reason for hiding this comment

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

Works great now! Ready to merge.

Copy link
Contributor

@markkuriekkinen markkuriekkinen left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines +361 to +362
if submissions.first():
submitter = submissions.first().submitters.first()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could do submission = submissions.first() instead of calling submissions.first() twice.

exercise/staff_views.py Show resolved Hide resolved
@markkuriekkinen markkuriekkinen merged commit 0a5d7f5 into apluslms:master May 30, 2023
Copy link
Contributor

@markkuriekkinen markkuriekkinen left a comment

Choose a reason for hiding this comment

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

We have found bugs in the implementation.

  • The selected next submitter may be such a student who has already received manual grading on a submission other than the latest one. A student should be considered manually graded once any one of his/her submissions has been manually graded. The "next submitter" link should not repeat a student who has been manually graded.
  • The "next submitter" link may repeat the same student who was already being inspected. This happens when the student's earlier submission (but not the latest) has been manually graded even though other students have not received any manual grading.
  • When all students have received manual grading, the "next submitter" link must stop cycling between students like the old implementation had done. The old code has an if statement with the comment "There are no more unassessed submitters". It redirects back to the submission list.

Comment on lines +333 to +335
submissions = (submissions.annotate(latest=Max('submission_time'))
.filter(submission_time=F('latest'))
.order_by('latest'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this filters only the latest submissions, the query for the "manually assessed submissions" does not check any other submissions than the latest ones. However, usually only one submission from the student is manually assessed and it is not always the latest submission.

If there are students who have not received any manual grading, those should be prioritized. Currently, the implementation may first select students that have received manual grading on an earlier submission.

submissions = Submission.objects.filter(exercise=self.exercise)

# filter only the latest submissions
submissions = (submissions.annotate(latest=Max('submission_time'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the annotate call really query the latest submission for each submitter separately? I didn't try it, but usually GROUP BY queries include a values() invocation.

Useful links:

# filter only the latest submissions
submissions = (submissions.annotate(latest=Max('submission_time'))
.filter(submission_time=F('latest'))
.order_by('latest'))

previous_user_id = request.GET.get('prev')
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought, since the old code is changed to order by submission times, would it be more useful to set the previous timestamp to the prev GET query parameter instead of the user id?

markkuriekkinen added a commit to markkuriekkinen/a-plus that referenced this pull request Jun 18, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Chronological order for the students in the "assess next submitter manually" feature
3 participants