Skip to content

[Bugfix:TAGrading] Auto-open single file#12625

Merged
bmcutler merged 31 commits into
Submitty:mainfrom
NiharikaSaxena18:auto-open-file
Jul 1, 2026
Merged

[Bugfix:TAGrading] Auto-open single file#12625
bmcutler merged 31 commits into
Submitty:mainfrom
NiharikaSaxena18:auto-open-file

Conversation

@NiharikaSaxena18

@NiharikaSaxena18 NiharikaSaxena18 commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Fixes #12482

The existing autoscroll feature only reopens files when filenames match exactly with previously saved state. This breaks in cases where students submit files with different names, forcing graders to manually open files even for simple single-file submissions.

What is the New Behavior?

  • When autoscroll is enabled:

    • The system first attempts to reopen previously opened files (existing behavior)
    • If no files are reopened and exactly one file is submitted, that file is automatically opened
  • Works for:

    • Regular files (openFrame)
    • Image files (viewFileFullPanel)
  • No change in behavior when:

    • Multiple files are submitted
    • Previously saved files can be successfully reopened

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Enable autoscroll in grading interface
  2. Open a submission with a previously saved filename
  3. Submit a new version with a different filename

Before this PR:

  • No file is automatically opened

After this PR:

  • If only one file exists, it is automatically opened

Additional checks:

  • Test with multiple files → no auto-open should occur
  • Test when saved filenames match → existing behavior should remain unchanged

Automated Testing & Documentation

  • No automated tests added in this PR
  • This change affects frontend behavior and can be validated manually through UI testing
  • Documentation update not required

Other information

  • Not a breaking change
  • No database migrations required
  • No known security concerns

@JManion32 JManion32 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @NiharikaSaxena18 thank you for your contribution!

Change the title prefix to [Bugfix:TAGrading], since this is solving an issue.

Please use our PR description template. This is important for keeping pull requests consistent and easy to review. It can be found here:
https://raw.githubusercontent.com/Submitty/Submitty/refs/heads/main/.github/PULL_REQUEST_TEMPLATE.md

Please include a Cypress test for this change.

Please also review #12492, which is solving the same issue. If it is solving the issue, great. If not, explain why your implementation is an improvement.

Thank you!

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Mar 22, 2026
@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.35%. Comparing base (caf11ea) to head (f04fcc5).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12625      +/-   ##
============================================
- Coverage     21.36%   21.35%   -0.01%     
  Complexity     9990     9990              
============================================
  Files           274      275       +1     
  Lines         37300    37317      +17     
  Branches        499      505       +6     
============================================
  Hits           7969     7969              
- Misses        28836    28847      +11     
- Partials        495      501       +6     
Flag Coverage Δ
autograder 21.16% <ø> (ø)
js 1.98% <0.00%> (-0.02%) ⬇️
migrator 100.00% <ø> (ø)
php 20.41% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NiharikaSaxena18 NiharikaSaxena18 changed the title [Feature:TAGrading] Auto-open single file [Bugfix:TAGrading] Auto-open single file Mar 23, 2026
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Mar 23, 2026
@github-actions github-actions Bot added the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Apr 13, 2026
@GarvitKhandelwal31

Copy link
Copy Markdown
Contributor

@NiharikaSaxena18 Please fix the JS linting

@GarvitKhandelwal31

GarvitKhandelwal31 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Hey @NiharikaSaxena18 thank you for your contribution!

Change the title prefix to [Bugfix:TAGrading], since this is solving an issue.

Please use our PR description template. This is important for keeping pull requests consistent and easy to review. It can be found here: https://raw.githubusercontent.com/Submitty/Submitty/refs/heads/main/.github/PULL_REQUEST_TEMPLATE.md

Please include a Cypress test for this change.

Please also review #12492, which is solving the same issue. If it is solving the issue, great. If not, explain why your implementation is an improvement.

Thank you!

@NiharikaSaxena18 Please add Cypress test.

@NicholasCiuica
NicholasCiuica self-requested a review June 11, 2026 19:12
@NicholasCiuica NicholasCiuica self-assigned this Jun 12, 2026
@NicholasCiuica

NicholasCiuica commented Jun 12, 2026

Copy link
Copy Markdown
Member

After trying to test this PR and reviewing the code, I have found that the current jquery selection for counting the number of student-submitted files erroneously counts auto-generated files starting with . like ".submit.timestamp". I pick up this PR and fix its bugs and then have it reviewed by someone else so this feature can be merged.

And a note to reviewers: autoscroll is enabled by the "Auto Open" button.

Changed how the number of submission files is counted to ignore files starting with . in the submission folder, because those are autogenerated on submission
@NicholasCiuica

Copy link
Copy Markdown
Member

Because folders and files are counted to detect whether any file is opened, if a grader manually opens the submissions folder and nothing else, then the single-file auto open feature will be disabled. This is expected behavior (and may be useful if e.g. the grader is only interested in checking the names of the files in the submission folder) but could be confusing.

Also, I added that whenever a non-image file is opened, the submissions folder is also opened, so that the submitted file's frame can be visible without the grader manually opening the submissions folder. This behavior is technically not part of the originally mentioned new behavior of the PR, but I thought it would make the feature less confusing. Whoever reviews this, please let me know what you think of this change.

@NicholasCiuica NicholasCiuica left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am going to write a Cypress test before getting this re-reviewed.

@NicholasCiuica NicholasCiuica moved this from In Review to Work in Progress in Submitty Development Jun 19, 2026
NicholasCiuica added a commit that referenced this pull request Jun 24, 2026
tweaking this auto-open PR to match better with another auto-open PR I'm working on, to reduce possible merge conflicts. I also prefer the way that #12625 fetches the file clickable area in the submission browser.
Prepping to reduce merge conflicts between this PR and Submitty#12931 by matching the format of the code shared between them.
@NicholasCiuica
NicholasCiuica marked this pull request as draft June 26, 2026 15:32
experimental change that copies over the dotfile logic from recent PR Submitty#12924. The original logic is in PHP, so the easiest way to make it accessible was to copy it over into JS, but there are probably better solutions that I'll be discussing at the meeting today.
I have copied over an array of meta file names and a meta file function to the ta-grading-panels-init so I don't have to make a connection between the php and js
@NicholasCiuica
NicholasCiuica marked this pull request as ready for review June 26, 2026 17:46
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to Seeking Reviewer in Submitty Development Jun 26, 2026
@NicholasCiuica
NicholasCiuica requested a review from mattLif June 26, 2026 19:22
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development Jun 26, 2026
@GarvitKhandelwal31
GarvitKhandelwal31 self-requested a review June 26, 2026 19:45

@GarvitKhandelwal31 GarvitKhandelwal31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was curious if could we centralize the logic of creating the meta submission array and the checker function so that any future code can also use this. Furthermore it would also ensure better consistency while making edits.
I would suggest creating a file-utils.ts in site/ts/utils , the same way it was implemented in PR#12924.
Thoughts??

@NicholasCiuica

Copy link
Copy Markdown
Member

I was curious if could we centralize the logic of creating the meta submission array and the checker function so that any future code can also use this. Furthermore it would also ensure better consistency while making edits. I would suggest creating a file-utils.ts in site/ts/utils , the same way it was implemented in PR#12924. Thoughts??

I believe this is a worthwhile change, so I made a commit just now implementing it, and I will bring it up at the meeting.

@GarvitKhandelwal31 GarvitKhandelwal31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did a retest again, and for me the feature does not seem to work correctly.

I tried with this submission-

Image

Then opening the next one-

Image

Maybe something is wrong with my environment??

We should probably wait for @mattLif to verify.

@mattLif mattLif left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Auto-open functionality works for me, so I think your issue might be with your environment. I agree that the usage file-utils.ts is optimal, and its implementation looks good. Only failing tests seem to be flaky, and I see no issues with the added test.

@NicholasCiuica

Copy link
Copy Markdown
Member

Maybe something is wrong with my environment??

We should probably wait for @mattLif to verify.

I believe your issue is due to the fact that the submissions and submissions_processed folders and one student's submission were already open. If any folder or file is already open, then those will remain auto-opened and the single-file auto open behavior will be overridden.

@GarvitKhandelwal31 GarvitKhandelwal31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After retesting it again, I can verify the functionality works as expected, code looks good to me too.

@bmcutler
bmcutler merged commit d96835d into Submitty:main Jul 1, 2026
50 of 52 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Submitty Development Jul 1, 2026
jndlansh pushed a commit to jndlansh/Submitty that referenced this pull request Jul 1, 2026
### Why is this Change Important & Necessary?

Fixes Submitty#12482

The existing autoscroll feature only reopens files when filenames match
exactly with previously saved state. This breaks in cases where students
submit files with different names, forcing graders to manually open
files even for simple single-file submissions.

### What is the New Behavior?

* When autoscroll is enabled:

* The system first attempts to reopen previously opened files (existing
behavior)
* If no files are reopened **and exactly one file is submitted**, that
file is automatically opened
* Works for:

  * Regular files (`openFrame`)
  * Image files (`viewFileFullPanel`)
* No change in behavior when:

  * Multiple files are submitted
  * Previously saved files can be successfully reopened


### What steps should a reviewer take to reproduce or test the bug or
new feature?

1. Enable autoscroll in grading interface
2. Open a submission with a previously saved filename
3. Submit a new version with a **different filename**

**Before this PR:**

* No file is automatically opened

**After this PR:**

* If only one file exists, it is automatically opened

Additional checks:

* Test with multiple files → no auto-open should occur
* Test when saved filenames match → existing behavior should remain
unchanged


### Automated Testing & Documentation

* No automated tests added in this PR
* This change affects frontend behavior and can be validated manually
through UI testing
* Documentation update not required


### Other information

* Not a breaking change
* No database migrations required
* No known security concerns

---------

Co-authored-by: Justin Manion <[email protected]>
Co-authored-by: Garvit Khandelwal <[email protected]>
Co-authored-by: Nick Ciuica <[email protected]>
Co-authored-by: roye2 <[email protected]>
prestoncarman added a commit that referenced this pull request Jul 1, 2026
* main: (78 commits)
  [Bugfix:TAGrading] Auto-open single file (#12625)
  [Feature:InstructorUI] Add sortable columns to manage students (#12957)
  [Dependency] Bump php-ds/php-ds from 1.7.0 to 2.0.1 in /site (#12827)
  [Refactor:TAGrading] Events Infrastructure & StatusBanner (#12941)
  [Dependency] Bump sqlalchemy from 2.0.48 to 2.0.51 in /.setup/pip (#12884)
  [Bugfix:Developer] trust hashicorp for vagrant install (#12968)
  [Feature:TAGrading] Backend for submission clustering (#12886)
  [Bugfix:InstructorUI] Missing Subsection in the Edit User form (#12955)
  [Bugfix:Submission] Warning Banners Accessibility Fix (#12956)
  [Bugfix:System] Preserve signup fields (#12939)
  [Bugfix:InstructorUI] Fix Csv Download of Subsections (#12954)
  [Bugfix:InstructorUI] Fix Manage Students Toggle Columns (#12953)
  [Feature:TAGrading] Persistent Auto-Open (#12931)
  [Bugfix:Submission] Dot File Upload (#12924)
  [Refactor:System] Declutter workers (#12815)
  [Bugfix:Developer] save/restore autograding_containers.json (#12952)
  [Bugfix:InstructorUI] Create Course Validation (#12949)
  [Testing:Notifications] Fix grade_inquiries.spec.js (#12950)
  [UI/UX:System] Add fullscreen button vue component (#12936)
  [Bugfix:TAGrading] Student Name Resize (#12946)
  ...

# Conflicts:
#	.pylintrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Auto-open single PDF (or maybe regex-based?) in grading panel

8 participants