-
Notifications
You must be signed in to change notification settings - Fork 3
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
[OSDEV-1532] Fix date filter on the Moderation Queue page #469
base: main
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
📝 WalkthroughWalkthroughThis pull request introduces several updates to the Open Supply Hub project, focusing on API endpoint enhancements, bug fixes, and UI improvements. The changes include two new PATCH endpoints for moderation events and production locations, updates to the dynamic mapping for moderation events, improvements in date range handling, modifications to automated emails, and an update to the contributors endpoint response. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI
participant API
participant ModeratedLocation
User->>UI: Select/Enter Dates
UI->>UI: Validate Date Input
alt Valid Date
UI->>API: PATCH /api/v1/moderation-events/{moderation_id}/production-locations/{os_id}/
API->>ModeratedLocation: Create New Contribution
API->>UI: Return Success Response
else Invalid Date
UI->>User: Display Error Message
end
Possibly related PRs
Suggested reviewers
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
🧹 Nitpick comments (2)
src/react/src/components/Dashboard/DashboardModerationQueue.jsx (2)
88-88
: Consider refining or removing comments for clarity.
While comments are helpful for future maintainers, consider condensing or removing any extraneous text to keep them concise and maintainable.
161-162
: Shared logic with handleAfterDateChange.
Both handleAfterDateChange and handleBeforeDateChange follow the same approach to reset errors. Centralizing this logic in a small helper function could improve maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
doc/release/RELEASE-NOTES.md
(1 hunks)src/react/src/components/Dashboard/DashboardModerationQueue.jsx
(3 hunks)
🧰 Additional context used
📓 Learnings (1)
src/react/src/components/Dashboard/DashboardModerationQueue.jsx (3)
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:132-144
Timestamp: 2024-11-28T10:03:36.732Z
Learning: In the `DashboardModerationQueue.jsx` file, within the `handleBeforeDateChange` function, we should call dispatch actions even if there isn't a `date` value provided.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:112-124
Timestamp: 2024-11-28T10:02:44.696Z
Learning: In `src/react/src/components/Dashboard/DashboardModerationQueue.jsx`, within the `handleAfterDateChange` function, dispatch actions should be called even when `date` is null or undefined.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#448
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:68-69
Timestamp: 2024-12-10T15:05:22.329Z
Learning: In the `DashboardModerationQueue.jsx` file, the `isValidDateRange` function correctly uses `firstDate >= secondDate` to validate the date range.
🔇 Additional comments (4)
src/react/src/components/Dashboard/DashboardModerationQueue.jsx (3)
133-134
: Good practice resetting both date errors together.
These lines ensure both errors are cleared reliably before applying new validations.
142-142
: Dispatch call placement is consistent.
Makes sense to update the store before setting the error messages. This maintains a consistent state.
170-170
: Dispatch call is correct.
Ensures the beforeDate is updated in the store even with an invalid range. This keeps state changes consistent with user actions.
doc/release/RELEASE-NOTES.md (1)
27-27
: Documentation note accurately references OSDEV-1532 fix.
The release note aligns with the code fix in DashboardModerationQueue, confirming that a Data Moderator can now change the “Before” date despite an error state.
React App | Jest test suite - Code coverage reportTotal: 27.87%Your code coverage diff: -0.01% ▾ ✅ All code changes are covered |
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 |
Django App | Unittest test suite - Code coverage reportTotal: 80.19%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
OSDEV-1532 - Fixed the date range picker on the
Moderation Queue
page. A Data Moderator can change the Before date even if an Error message is displayed.