Skip to content

[Bugfix:CourseMaterials] Instructor Course Materials Upload Limit#12585

Merged
bmcutler merged 8 commits into
mainfrom
11457_course_materials_limit
Apr 12, 2026
Merged

[Bugfix:CourseMaterials] Instructor Course Materials Upload Limit#12585
bmcutler merged 8 commits into
mainfrom
11457_course_materials_limit

Conversation

@John-Roy123

@John-Roy123 John-Roy123 commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Closes #11457 by adding a 1 GB cap on all courses for course materials and text to inform instructor of their usage when uploading new course materials

What is the New Behavior?

Before:
image
(Instructors have no cap on their storage usage)
After:
image
image
image
image

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

  1. Log in as instructor
  2. Open course materials for a given course
  3. Upload new course materials
  4. See that disk usage for that item is correctly counted in the total
  5. Upload until you exceed 1 gb of usage
  6. Try to upload more course materials

Automated Testing & Documentation

Submitty.org documentation and e2e tests not yet created for this

Other information

This PR only affects new uploads for course materials, so courses currently exceeding the 1 gb cap will not lose their existing course materials

- Instructor users can now see what their storage usage is when uploading course materials
- When course material storage usage is over 900 MB text changes to red to draw user's attention
- When usage is over 1 GB, user can no longer upload course materials and are presented with bolded red text explaining the situation.
@codecov

codecov Bot commented Mar 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.64%. Comparing base (9cb25d6) to head (5040657).
⚠️ Report is 47 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12585      +/-   ##
============================================
- Coverage     21.66%   21.64%   -0.02%     
- Complexity     9637     9654      +17     
============================================
  Files           268      268              
  Lines         36222    36245      +23     
  Branches        487      487              
============================================
- Hits           7847     7846       -1     
- Misses        27892    27916      +24     
  Partials        483      483              
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.66% <100.00%> (-0.02%) ⬇️
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.

@bmcutler

Copy link
Copy Markdown
Member

Thanks for the PR. Looks like a good design. (I haven't tested)

Just looking at the images, the phrase "Total files cannot exceed 100mb" is confusing/misleading. I assume this the size of files uploaded with one click. So perhaps we should instead say "Maximum file size total per upload is 100mb" or similar.

Also, that upload limit size is configured for the server in various files:

https://submitty.org/sysadmin/installation/system_customization#increasing-the-max-number-of-files-that-can-be-uploaded-at-once

Is that 100mb hardcoded or is it actually reading the setting in the configuration file (which may have been altered from the default).

@John-Roy123

Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Looks like a good design. (I haven't tested)

Just looking at the images, the phrase "Total files cannot exceed 100mb" is confusing/misleading. I assume this the size of files uploaded with one click. So perhaps we should instead say "Maximum file size total per upload is 100mb" or similar.

Also, that upload limit size is configured for the server in various files:

https://submitty.org/sysadmin/installation/system_customization#increasing-the-max-number-of-files-that-can-be-uploaded-at-once

Is that 100mb hardcoded or is it actually reading the setting in the configuration file (which may have been altered from the default).

The 100 MB is based on a variable from the config. That was not something I added in this PR, but the upload limit and max storage are both configurable from the config file.

@Rkoester47 Rkoester47 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.

In my testing it seems this is working as intended, the file capacity is filling up as I upload materials. If 1000 MB is a default value you have not chosen to hardcode, then I think implementation makes sense.

A few notes I have:

  1. I think the warning before you hit the limit at 900 MB should be yellow/orange, and then the "exceeded limit" message can be red.
  2. I agree that the wording about the combined limits is somewhat confusing, and would benefit from the phrase "per upload".

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

John-Roy123 commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

In my testing it seems this is working as intended, the file capacity is filling up as I upload materials. If 1000 MB is a default value you have not chosen to hardcode, then I think implementation makes sense.

A few notes I have:

1. I think the warning before you hit the limit at 900 MB should be yellow/orange, and then the "exceeded limit" message can be red.

2. I agree that the wording about the combined limits is somewhat confusing, and would benefit from the phrase "per upload".

I changed it so that from 600 to 900 the text is orange, but at 900 it is still red. My thoughts are that when the instructor is at 900 it should have the same urgency as when they are past the limit, so it encourages them to trim/migrate the course materials before they run out of space.

@Rkoester47 Rkoester47 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 agree with your changes, I think keeping the red but adding a yellow tier of warning is good.

@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Mar 17, 2026
@hyeenaa
hyeenaa self-requested a review March 17, 2026 21:40
@automateprojectmangement automateprojectmangement Bot moved this from Awaiting Maintainer Review to In Review in Submitty Development Mar 17, 2026

@hyeenaa hyeenaa 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.

It works, as far as I can tell! I like the color coding, and the actual written code looks fine (coming from a mostly non php person)

@github-project-automation github-project-automation Bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Mar 20, 2026

@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.

The notes about usage and limits could be more concise:
Image
I propose something like this:
Image
and maybe make the labels bold.

A few other things: Make sure to address the failing CI tests. I suggest creating the documentation on submitty.org before this gets merged, otherwise it is likely that we will forget. I added some inline comments as well.

Great work with this.

Comment thread site/app/templates/course/UploadCourseMaterialsForm.twig
{% endif %}
{% if current_course_materials_storage_used_mb < max_course_materials_storage_limit_mb %}
{% if current_course_materials_storage_used_mb >= 900 %}
<p style="color: red;">You are currently using {{current_course_materials_storage_used_mb}} / {{max_course_materials_storage_limit_mb}} MB</p>

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.

Use CSS classes instead of inline styles. You can add them to course-materials.css. That way, we can easily add more styles in the future and share them between different elements.

<p>You are currently using {{current_course_materials_storage_used_mb}} / {{max_course_materials_storage_limit_mb}} MB</p>
{% endif %}
{% else %}
<strong style="color: red;">You have exceeded the maximum storage for Course Materials for this course. Please remove existing course materials before adding any new ones.</strong>

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.

Refer to my previous comment about abstracting to CSS classes. Instead of <strong>, use <p>, and set the font weight to bold inside of the class.

@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Work in Progress in Submitty Development Mar 21, 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 7, 2026
@John-Roy123 John-Roy123 removed the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Apr 7, 2026
@John-Roy123 John-Roy123 moved this from Work in Progress to Seeking Reviewer in Submitty Development Apr 7, 2026
@John-Roy123
John-Roy123 requested a review from JManion32 April 7, 2026 21:30
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development Apr 7, 2026
bmcutler pushed a commit to Submitty/submitty.github.io that referenced this pull request Apr 9, 2026
Updated course_materials.md so that it correctly matches the changes in
[#12585](Submitty/Submitty#12585) in the main
submitty repository
@John-Roy123 John-Roy123 moved this from In Review to Awaiting Maintainer Review in Submitty Development Apr 10, 2026
@automateprojectmangement automateprojectmangement Bot moved this from Awaiting Maintainer Review to In Review in Submitty Development Apr 10, 2026
@John-Roy123 John-Roy123 moved this from In Review to Awaiting Maintainer Review in Submitty Development Apr 10, 2026
@bmcutler
bmcutler merged commit 749e6a4 into main Apr 12, 2026
48 of 50 checks passed
@bmcutler
bmcutler deleted the 11457_course_materials_limit branch April 12, 2026 15:05
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Apr 12, 2026
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Apr 13, 2026
…bmitty#12585)

### Why is this Change Important & Necessary?
Addresses issue Submitty#11457 by adding a 1 GB cap on all courses for course
materials and text to inform instructor of their usage when uploading
new course materials

### What is the New Behavior?
Before:
<img width="1910" height="873" alt="image"
src="https://github.com/user-attachments/assets/13eee135-bc96-48f8-8978-a0746361680d"
/>
(Instructors have no cap on their storage usage)
After:
<img width="1906" height="876" alt="image"
src="https://github.com/user-attachments/assets/98c22b8b-d046-415d-806a-a945057e8333"
/>
<img width="1903" height="877" alt="image"
src="https://github.com/user-attachments/assets/46b77942-bd0a-4530-8d5a-d53d19e98de2"
/>
<img width="1909" height="881" alt="image"
src="https://github.com/user-attachments/assets/c63e4a19-288b-4006-b56a-31b37f887369"
/>
<img width="1909" height="879" alt="image"
src="https://github.com/user-attachments/assets/69417bcc-49f0-45f4-a4d2-3a3fcefefb34"
/>


### What steps should a reviewer take to reproduce or test the bug or
new feature?
1) Log in as instructor
2) Open course materials for a given course
3) Upload new course materials
4) See that disk usage for that item is correctly counted in the total
5) Upload until you exceed 1 gb of usage
6) Try to upload more course materials

### Automated Testing & Documentation
Submitty.org documentation and e2e tests not yet created for this

### Other information
This PR only affects new uploads for course materials, so courses
currently exceeding the 1 gb cap will not lose their existing course
materials

---------

Co-authored-by: Justin Manion <[email protected]>
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.

Implement limit of course materals per course

5 participants