Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Innavin369
Copy link
Contributor

@Innavin369 Innavin369 commented Dec 23, 2024

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.

@Innavin369 Innavin369 requested review from vladsha-dev and VadimKovalenkoSNF and removed request for vladsha-dev December 23, 2024 14:46
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 requested review from vladsha-dev and roman-stolar and removed request for VadimKovalenkoSNF December 23, 2024 14:46
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:46 — with GitHub Actions Inactive
@Innavin369 Innavin369 self-assigned this Dec 23, 2024
Copy link

coderabbitai bot commented Dec 23, 2024

📝 Walkthrough

Walkthrough

This 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

File Change Summary
doc/release/RELEASE-NOTES.md Added release notes for version 1.27.0, documenting new API endpoints, bug fixes, and improvements
src/react/src/components/Dashboard/DashboardModerationQueue.jsx Enhanced date input error handling and validation logic for date pickers

Sequence Diagram

sequenceDiagram
    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
Loading

Possibly related PRs

Suggested reviewers

  • vladsha-dev
  • roman-stolar
  • mazursasha1990

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between bd158e1 and da8d4df.

📒 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.

@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:48 — with GitHub Actions Inactive
Copy link

barecheck bot commented Dec 23, 2024

React App | Jest test suite - Code coverage report

Total: 27.87%

Your code coverage diff: -0.01% ▾

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:52 — with GitHub Actions Inactive
Copy link

barecheck bot commented Dec 23, 2024

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 56.14%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:53 — with GitHub Actions Inactive
Copy link

barecheck bot commented Dec 23, 2024

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 14:53 — with GitHub Actions Inactive
Copy link

barecheck bot commented Dec 23, 2024

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.91%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment December 23, 2024 15:03 — with GitHub Actions Inactive
Copy link

barecheck bot commented Dec 23, 2024

Django App | Unittest test suite - Code coverage report

Total: 80.19%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment December 25, 2024 14:34 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment December 25, 2024 14:51 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant