Fix duplicate community library submission#5773
Open
AlexVelezLl wants to merge 1 commit intolearningequality:unstablefrom
Open
Fix duplicate community library submission#5773AlexVelezLl wants to merge 1 commit intolearningequality:unstablefrom
AlexVelezLl wants to merge 1 commit intolearningequality:unstablefrom
Conversation
rtibblesbot
approved these changes
Mar 20, 2026
Contributor
rtibblesbot
left a comment
There was a problem hiding this comment.
Clean fix for the duplicate submission bug.
CI pending (frontend tests, Python unit tests, linting still running). No UI files changed.
- praise: Root cause is well-identified — the hardcoded
-date_updatedordering caused recently-updated older submissions to shadow newer ones, allowing duplicate creation. The fix correctly separates the default ordering from the queryset and enables client-specified ordering viaValuesViewsetOrderingFilter, which is the established pattern in this codebase.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
Reviewed the pull request diff checking for:
- Correctness: bugs, edge cases, undocumented behavior, resource leaks, hardcoded values
- Design: unnecessary complexity, naming, readability, comment accuracy, redundant state
- Architecture: duplicated concerns, minimal interfaces, composition over inheritance
- Testing: behavior-based assertions, mocks only at hard boundaries, accurate coverage
- Completeness: missing dependencies, unupdated usages, i18n, accessibility, security
- Principles: DRY (same reason to change), SRP, Rule of Three (no premature abstraction)
- Checked CI status and linked issue acceptance criteria
- For UI changes: inspected screenshots for layout, visual completeness, and consistency
| pagination_class = CommunityLibrarySubmissionPagination | ||
|
|
||
| ordering_fields = ["date_updated", "date_created"] | ||
| ordering = "-date_updated" |
Contributor
There was a problem hiding this comment.
praise: Good design — setting ordering = "-date_updated" as the viewset default preserves backward compatibility for all other callers while enabling the frontend to override with -date_created when needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes community library submission ordering when requesting the latest submission. The error occurred because on the submission side panel, we query the latest submission to know if a submission already exists, but the ordering was set to "-updated_date" by default. Therefore, if a previous submission was recently updated, we will get this previous submission, instead of the "newer created submission". Therefore, allowing the user to make the request to create a submission that already exists.
References
Closes #5766.
Reviewer guidance