-
Notifications
You must be signed in to change notification settings - Fork 221
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
Fix student download submission bug to have unique names #2244
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes in the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
app/controllers/users_controller.rb (1)
199-215
: Consider adding tests for the versioning logic.The implementation correctly handles duplicate filenames by appending version numbers while preserving file extensions. However, to prevent regression, consider adding tests that verify:
- Files without duplicates remain unchanged
- Duplicate files get correct version numbers
- File extensions are preserved correctly
Would you like me to help create test cases for these scenarios?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
app/controllers/users_controller.rb
(1 hunks)
🔇 Additional comments (1)
app/controllers/users_controller.rb (1)
192-197
: LGTM! Effective solution for tracking duplicate filenames.
The implementation efficiently tracks duplicate filenames using a hash with default value of 0, which is a good practice for counting occurrences.
Description
Fix bug missed by #2137.
If a file has multiple files with the same name, will add unique identifier at end to differentiate files and ensure zipping for download all submissions feature for students does not run into issues.
Motivation and Context
If a student has multiple submissions with the same submission file name, downloading the submissions will run into issues because there are multiple files of the same name being zipped together. Issue occurred in production.
The change will append "_ver{#}" to the name of the file if there are multiple files with that same name to differentiate the different files and allow for smooth folder compression.
Fixes #2188.
How Has This Been Tested?
To test, duplicates the files when downloading (so file names had multiples) to ensure version naming worked.
For files that don't have duplicate file names, feature does not add the unique name modification (what it was like previously).
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for lintingOther issues / help required
If unsure, feel free to submit first and we'll help you along.