[OSDEV-1493] Moderation. Moderation Queue Page (integration) - sorting issue and 500 error for localization#451
Conversation
… their `alpha-2 codes` in `GET /api/v1/moderation-events/` endpoint.
React App | Jest test suite - Code coverage reportTotal: 27.88%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces a new release section for version 1.27.0 in the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Dedupe Hub App | Unittest test suite - Code coverage reportTotal: 56.14%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Countries App | Unittest test suite - Code coverage reportTotal: 100%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Contricleaner App | Unittest test suite - Code coverage reportTotal: 98.91%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
doc/release/RELEASE-NOTES.md (1)
23-24: Consider adding more details about the fixed issues.The bugfix entries would benefit from additional context:
- For OSDEV-1493: Explain the impact of sorting by alpha-2 codes vs names
- For OSDEV-1492: Describe what caused the 500 error and how it was fixed
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
doc/release/RELEASE-NOTES.md(1 hunks)
🔇 Additional comments (4)
doc/release/RELEASE-NOTES.md (4)
Line range hint 1-7: LGTM! The release notes header follows best practices.
The header section properly documents:
- Project versioning scheme (Semantic Versioning)
- Template usage
- File purpose
Line range hint 9-13: LGTM! The release metadata is complete.
The introduction section properly includes:
- Product name
- Release date
Line range hint 1-1024: LGTM! Version numbering follows semantic versioning.
The release history demonstrates consistent use of semantic versioning:
- Major version (1.x.x) for backwards-incompatible changes
- Minor version (x.22.x to x.27.x) for new features
- Patch version (x.x.1, x.x.2) for hotfixes
Line range hint 26-29: Verify the post-deployment commands.
The release instructions mention two commands:
migratereindex_database
Please verify that these commands are sufficient and no additional steps are needed.
✅ Verification successful
Let me analyze the post_deployment.py command to verify what commands it runs.
The release notes accurately reflect the required post-deployment commands
The post_deployment command in the codebase executes exactly the two commands mentioned in the review:
migratereindex_database
These commands are sufficient as they handle both database schema updates and reindexing operations, which are the critical steps needed after deployment.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any additional migration or indexing commands in recent commits
# Search for any new migration files
fd -e py -p ".*_[0-9]{4}_.*\.py$" | grep -i "migrations"
# Search for management commands that might need to be run
rg -A 5 "class Command\(BaseCommand\)"
Length of output: 16365
Script:
#!/bin/bash
# Check the implementation of post_deployment command
cat src/django/api/management/commands/post_deployment.py
Length of output: 498
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
doc/release/RELEASE-NOTES.md (3)
Line range hint
1-24: Update the release date to a past date.The release date is set to December 28, 2024, which is a future date. Release notes should document past releases.
## Introduction * Product name: Open Supply Hub - * Release date: December 28, 2024 + * Release date: December 19, 2023
21-24: Consider adding more details to the bugfix descriptions.The bugfix entries would benefit from additional context about the impact and resolution:
### Bugfix - * [OSDEV-1492](https://opensupplyhub.atlassian.net/browse/OSDEV-1492) - Fixed an issue where invalid manually entered dates were not validated on the UI, resulting in API errors with message "The request query is invalid." on `Moderation Queue` page. Invalid dates are now trimmed and properly handled. - * [OSDEV-1493](https://opensupplyhub.atlassian.net/browse/OSDEV-1493) - Fixed an issue where the backend sorts countries not by `name` but by their `alpha-2 codes` in `GET /api/v1/moderation-events/` endpoint. + * [OSDEV-1492](https://opensupplyhub.atlassian.net/browse/OSDEV-1492) - Fixed date validation on the Moderation Queue page + - Issue: Invalid manually entered dates were not validated on the UI, causing API errors with "The request query is invalid" + - Resolution: Added client-side validation to trim and properly handle invalid dates + - Impact: Users no longer encounter API errors when entering dates + * [OSDEV-1493](https://opensupplyhub.atlassian.net/browse/OSDEV-1493) - Fixed country sorting in moderation events + - Issue: Countries were sorted by alpha-2 codes instead of names in GET /api/v1/moderation-events/ + - Resolution: Updated sorting to use country names + - Impact: Improved readability of country listings in moderation events
Line range hint
26-30: Consider formatting release instructions as a checklist.The release instructions would be clearer as a checklist format:
### Release instructions: - * Ensure that the following commands are included in the `post_deployment` command: - * `migrate` - * `reindex_database` + Please complete the following steps in order: + - [ ] Ensure the `post_deployment` command includes: + - [ ] `migrate` - Apply database migrations + - [ ] `reindex_database` - Rebuild search indexes
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
src/django/api/tests/test_moderation_events_query_builder.py (1)
91-94: LGTM! The test correctly validates the country sorting behavior.The test effectively verifies that countries are now sorted by name instead of alpha-2 codes, which aligns with the PR objectives.
Consider adding these test cases for completeness:
def test_add_sort_country_desc(self): self.builder.add_sort('country', 'desc') expected = {'cleaned_data.country.name': {'order': 'desc'}} self.assertIn(expected, self.builder.query_body['sort']) def test_add_sort_country_no_longer_uses_alpha_2(self): self.builder.add_sort('country', 'asc') unexpected = {'cleaned_data.country.alpha_2': {'order': 'asc'}} self.assertNotIn(unexpected, self.builder.query_body['sort'])
|
@VadimKovalenkoSNF @vladsha-dev Ready for re-review |
|



OSDEV-1493 Moderation. Moderation Queue Page (integration) - sorting issue and 500 error for localization
namebut by theiralpha-2 codesinGET /api/v1/moderation-events/endpoint.