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

[WEB-2872] chore: removed the deleted votes and reaction in published project #6218

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

NarayanBavisetti
Copy link
Collaborator

@NarayanBavisetti NarayanBavisetti commented Dec 17, 2024

Description

This pull request resolves the error with deleted votes and reactions in the published project.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

References - WEB-2872

Summary by CodeRabbit

  • New Features

    • Enhanced aggregation of issue votes and reactions to exclude deleted items, improving data accuracy.
    • Updated data structure for votes and reactions to include actor details and avatar URLs.
  • Bug Fixes

    • Corrected filtering logic to ensure only non-deleted votes and reactions are considered in API responses.

Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Walkthrough

The pull request introduces modifications to the issue_on_results function in the grouper.py file and the IssueRetrievePublicEndpoint class in the issue.py file. The primary change involves enhancing the filtering conditions for vote and reaction items by adding checks for the deleted_at field. This ensures that only non-deleted votes and reactions are included in the aggregation process, improving the data integrity and accuracy of the API responses.

Changes

File Change Summary
apiserver/plane/space/utils/grouper.py Updated issue_on_results function to filter vote and reaction items by checking deleted_at is null
apiserver/plane/space/views/issue.py Modified IssueRetrievePublicEndpoint to include deleted_at checks in vote_items and reaction_items annotations

Sequence Diagram

sequenceDiagram
    participant API as API Endpoint
    participant Grouper as Issue Grouper
    participant DB as Database
    
    API->>Grouper: Request issue details
    Grouper->>DB: Query issues with filtered votes/reactions
    DB-->>Grouper: Return non-deleted votes and reactions
    Grouper-->>API: Aggregate and return filtered results
Loading

Possibly related PRs

Suggested labels

🐛bug, ⚙️backend

Suggested reviewers

  • pablohashescobar
  • sriramveeraghanta
  • pushya22

Poem

🐰 Votes and reactions, once lost in the maze,
Now filtered with care, in CodeRabbit's ways
Deleted items vanish, clean and bright
Our data shines pure, a technological delight!
Hop, hop, hooray for clean code today! 🎉

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ddd4b51 and 9365789.

📒 Files selected for processing (2)
  • apiserver/plane/space/utils/grouper.py (3 hunks)
  • apiserver/plane/space/views/issue.py (4 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
apiserver/plane/space/utils/grouper.py

155-155: Line too long (94 > 88)

(E501)

🔇 Additional comments (4)
apiserver/plane/space/utils/grouper.py (2)

Line range hint 94-121: LGTM: Vote filtering logic properly handles deleted votes

The implementation correctly filters out deleted votes by checking votes__deleted_at__isnull=True in both the When condition and the filter argument of ArrayAgg.


Line range hint 128-155: LGTM: Reaction filtering logic properly handles deleted reactions

The implementation correctly filters out deleted reactions by checking issue_reactions__deleted_at__isnull=True in both the When condition and the filter argument of ArrayAgg.

apiserver/plane/space/views/issue.py (2)

Line range hint 704-740: LGTM: Vote filtering logic properly handles deleted votes

The implementation correctly filters out deleted votes by checking votes__deleted_at__isnull=True in both the When condition and the filter argument of ArrayAgg.


Line range hint 704-788: Verify consistent handling of deleted votes and reactions

Let's verify that all other places in the codebase properly handle deleted votes and reactions.

✅ Verification successful

Consistent handling of deleted votes and reactions verified

Based on the search results, the handling of deleted votes and reactions is consistent across the codebase. The deleted_at__isnull=True check is properly implemented in both files where votes and reactions are queried:

  • apiserver/plane/space/views/issue.py
  • apiserver/plane/space/utils/grouper.py

Both files consistently check for:

  • votes__deleted_at__isnull=True
  • issue_reactions__deleted_at__isnull=True
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other vote/reaction queries that might need similar deleted_at checks

# Check for vote queries
rg -A 5 "votes__" --type py

# Check for reaction queries
rg -A 5 "issue_reactions__" --type py

# Check for ArrayAgg usage with votes or reactions
ast-grep --pattern 'ArrayAgg(
  $$$
  filter=$_
  $$$
)'

Length of output: 13374


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.

@pushya22 pushya22 merged commit ec41ae6 into preview Dec 18, 2024
12 of 14 checks passed
@pushya22 pushya22 deleted the chore/votes-reactions branch December 18, 2024 09:24
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.

3 participants