Skip to content

Automatically collect scanned submissions#8069

Merged
david-yz-liu merged 10 commits into
MarkUsProject:masterfrom
akarki2005:automatically-collect-scanned-submissions
Jul 23, 2026
Merged

Automatically collect scanned submissions#8069
david-yz-liu merged 10 commits into
MarkUsProject:masterfrom
akarki2005:automatically-collect-scanned-submissions

Conversation

@akarki2005

@akarki2005 akarki2005 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

This adds automatic submission collection for scanned exam papers. Currently, once all of a paper's pages have been scanned and matched (or matched after manually fixing any error pages), an instructor still has to go to the Submissions tab and manually collect it before grading can begin. With this change, MarkUs collects the submission automatically as soon as a paper is complete and hasn't already been collected, so this manual step is no longer needed for the common case.

Completion can happen in two different places, so autocollection is triggered from both: when a batch of scans is uploaded and a paper's pages all match successfully on the first pass (SplitPdfJob), and when an instructor manually fixes the last missing or erroring page for a paper through "Fix Errors" (ExamTemplate#fix_error). To support this, the ExamTemplate model now contains methods #missing_pages and #paper_complete? to determine whether a paper is done, and #collect_if_complete, which performs the actual collection once it is.

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality) X
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
📖 Documentation update (change that updates documentation)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • [N/A] If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

Hi @david-yz-liu, I wanted to ask whether or not we should have some sort of UI feedback telling instructors that some submissions were automatically collected when they upload scans in bulk (something like "X submissions are now complete and were automatically collected")?

@coveralls

coveralls commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 30018677425

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.08%) to 90.513%

Details

  • Coverage increased (+0.08%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (90 of 91 lines covered, 98.9%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
app/controllers/exam_templates_controller.rb 1 0 0.0%
Total (6 files) 91 90 98.9%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 51477
Covered Lines: 47611
Line Coverage: 92.49%
Relevant Branches: 2470
Covered Branches: 1218
Branch Coverage: 49.31%
Branches in Coverage %: Yes
Coverage Strength: 128.2 hits per line

💛 - Coveralls

@akarki2005
akarki2005 requested a review from david-yz-liu July 21, 2026 15:38

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @akarki2005. I left a few inline comments, and in response to your question let's not worry about including a message to the user about this. Instead we'll rely on the behaviour that complete papers are always collected and incomplete papers aren't, unless the instructor collects them manually.

Comment thread app/models/exam_template.rb Outdated
Comment thread spec/controllers/exam_templates_controller_spec.rb Outdated
Comment thread spec/controllers/exam_templates_controller_spec.rb Outdated
@akarki2005
akarki2005 force-pushed the automatically-collect-scanned-submissions branch from 2b13517 to dda50fd Compare July 23, 2026 15:02
@akarki2005
akarki2005 requested a review from david-yz-liu July 23, 2026 15:16

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work, @akarki2005!

@david-yz-liu
david-yz-liu merged commit d10c644 into MarkUsProject:master Jul 23, 2026
8 checks passed
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