[Bugfix:CourseMaterials] Instructor Course Materials Upload Limit#12585
Conversation
- 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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
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: 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
left a comment
There was a problem hiding this comment.
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:
- 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.
- 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
left a comment
There was a problem hiding this comment.
I agree with your changes, I think keeping the red but adding a yellow tier of warning is good.
hyeenaa
left a comment
There was a problem hiding this comment.
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)
JManion32
left a comment
There was a problem hiding this comment.
The notes about usage and limits could be more concise:

I propose something like this:

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.
| {% 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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
Updated course_materials.md so that it correctly matches the changes in [#12585](Submitty/Submitty#12585) in the main submitty repository
…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]>
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:





(Instructors have no cap on their storage usage)
After:
What steps should a reviewer take to reproduce or test the bug or new feature?
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