-
Notifications
You must be signed in to change notification settings - Fork 220
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
Order assessment attachments correctly #2145
Order assessment attachments correctly #2145
Conversation
WalkthroughWalkthroughThe recent update in the codebase focuses on enhancing the attachment handling logic within the Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (1)
Additional comments not posted (1)
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Thanks for catching this - it was an oversight on my part Just a thought: course attachments are ordered on the course page due to For consistency, I think either
Option (1) is probably better, in which case the same What do you think? |
I originally experimented with option 2 while I was tracing the source of the lack of ordering, but I settled on option 1 (for assessment attachments) because I can't think of a scenario where we'd want the unordered attachments. I think doing the same for course attachments makes sense.
SELECT `attachments`.* FROM `attachments` WHERE `attachments`.`course_id` = 28 AND `attachments`.`assessment_id` IS NULL AND `attachments`.`category_name` = 'General3' If I correctly order them before applying the SELECT `attachments`.* FROM `attachments` WHERE `attachments`.`course_id` = 28 AND `attachments`.`assessment_id` IS NULL AND `attachments`.`category_name` = 'General3' ORDER BY release_at ASC, name ASC |
That sounds good to me, could you make the change to order course attachments on the backend too?
In that case, I think it's safe to remove the ordering for course attachments on the frontend. Thanks for investigating this! |
No problem, how does this look? |
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.
Tested that attachments are ordered as expected on course / assessment pages
LGTM!
Description
This update fixes the sorting order of assessment attachments.
Motivation and Context
When rendering attachments on the assessment page, they're ordered how the database returns them instead of by the desired "release_at ASC, name ASC" ordering constant. Course attachments are correct and it already calls
.ordered
in the same way I did here. If an instructor wants to re-order attachments, they currently need to delete them and re-upload them. This fix would allow them to only update the release date to re-order them. I also believe this was the intended behavior, but forgetting to call.ordered
was an oversight.How Has This Been Tested?
I created two course attachments, A and B, with B's release date after A's. I verified B appears after A in the list. I updated B's release date to be before A's. I verified B appears before A in the list.
Types of changes
Potentially breaking change: Some instructors may depend on the "manual" method of ordering attachments as described above. That was ultimately a bug, and it never should have behaved that way, but maybe this should wait until the semester is over.
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for lintingSummary by CodeRabbit