plane icon indicating copy to clipboard operation
plane copied to clipboard

chore: Reverse order by of priority keys

Open rahulramesha opened this issue 1 year ago • 1 comments

This PR focuses on reversing the priority keys for order by based on priority. Basically if priority was the key for sorting from urgent to low, after this PR -priority will be the key for urgent to low

Summary by CodeRabbit

  • New Features
    • Updated sorting logic for issue priorities, reversing the order for both display and spreadsheet contexts. Higher priority issues will now appear first in descending order.
  • Bug Fixes
    • Corrected inconsistencies in sorting keys across various configurations to ensure a unified display of issues based on priority.

rahulramesha avatar Sep 12 '24 09:09 rahulramesha

Walkthrough

The changes involve a comprehensive update to the sorting logic for issue priorities across multiple files in the codebase. The adjustments primarily include reversing the order of sorting keys for priority, transitioning from ascending to descending order and vice versa. This modification affects how issues are displayed and prioritized in both user interfaces and spreadsheets, ensuring that higher-priority items are positioned accordingly based on the new logic.

Changes

Files Change Summary
apiserver/plane/utils/order_queryset.py Modified order_issue_queryset function to reverse the logic for order_by_param, changing how issues are sorted based on input parameters.
web/core/constants/issue.ts Updated ISSUE_ORDER_BY_OPTIONS and ISSUE_DISPLAY_FILTERS_BY_LAYOUT to change sorting key for "Priority" from "priority" to "-priority" for consistency in descending order.
web/core/constants/spreadsheet.ts Altered SPREADSHEET_PROPERTY_DETAILS to swap ascending and descending order keys for priority, changing from "-priority" to "priority" and vice versa.
web/core/store/issue/helpers/base-issues.store.ts Changed sorting logic in BaseIssuesStore class, swapping cases for "priority" and "-priority", affecting how issues are sorted by priority values.

Poem

In the fields where issues hop,
Priorities now take a flip-flop.
Higher ranks leap to the front,
While lower ones take a gentle jaunt.
Sorting's a dance, a playful spree,
Hooray for changes, come join me! 🐇✨


Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL

Commits

Files that changed from the base of the PR and between 33dd5fe8cc3c8fd574259a5879f311013754fc4f and 1f2cc1275a60f0a6f884e340c3eb8560d69b9673.

Files selected for processing (4)
  • apiserver/plane/utils/order_queryset.py (1 hunks)
  • web/core/constants/issue.ts (10 hunks)
  • web/core/constants/spreadsheet.ts (1 hunks)
  • web/core/store/issue/helpers/base-issues.store.ts (1 hunks)
Additional comments not posted (10)
apiserver/plane/utils/order_queryset.py (1)

33-35: Verify the impact of the sorting order change.

The updated logic for handling the "priority" ordering case looks good and aligns with the PR objective of reversing the order of priority keys. The code changes are implemented correctly.

However, please verify that this change produces the desired issue ordering behavior across all relevant parts of the application where the order_issue_queryset function is called with the "priority" or "-priority" parameter. Ensure that there are no unintended side effects or inconsistencies in the issue ordering.

Run the following script to find all occurrences of order_issue_queryset and analyze how it's being used:

web/core/constants/spreadsheet.ts (2)

118-118: LGTM!

The change to the ascendingOrderKey for the priority property is consistent with the PR objective of reversing the order of priority keys. This will correctly sort priority items in ascending order, with lower priority values appearing first.


120-120: LGTM!

The change to the descendingOrderKey for the priority property is consistent with the PR objective of reversing the order of priority keys. This will correctly sort priority items in descending order, with higher priority values appearing first.

web/core/constants/issue.ts (5)

98-98: LGTM!

The change to the sorting key for "Priority" in ISSUE_ORDER_BY_OPTIONS from "priority" to "-priority" is consistent with the PR objective of reversing the order of priority keys. This will ensure that issues with higher priority will appear first when sorted by priority.


211-211: LGTM!

The change to the sorting key for "Priority" in ISSUE_DISPLAY_FILTERS_BY_LAYOUT.profile_issues.list.display_filters.order_by from "priority" to "-priority" is consistent with the PR objective and the modifications made in other parts of the file. This will ensure that the sorting logic related to issue prioritization is updated comprehensively across various display filter configurations.


224-224: LGTM!

The change to the sorting key for "Priority" in ISSUE_DISPLAY_FILTERS_BY_LAYOUT.profile_issues.kanban.display_filters.order_by from "priority" to "-priority" is consistent with the PR objective and the modifications made in other parts of the file. This will ensure that the sorting logic related to issue prioritization is updated comprehensively across various display filter configurations.


260-260: LGTM!

The changes to the sorting key for "Priority" in ISSUE_DISPLAY_FILTERS_BY_LAYOUT.archived_issues.list.display_filters.order_by and ISSUE_DISPLAY_FILTERS_BY_LAYOUT.draft_issues.list.display_filters.order_by from "priority" to "-priority" are consistent with the PR objective and the modifications made in other parts of the file. This will ensure that the sorting logic related to issue prioritization is updated comprehensively across various display filter configurations.

Also applies to: 275-275


288-288: LGTM!

The changes to the sorting key for "Priority" in ISSUE_DISPLAY_FILTERS_BY_LAYOUT.draft_issues.kanban.display_filters.order_by, ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues.list.display_filters.order_by, ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues.kanban.display_filters.order_by, ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues.spreadsheet.display_filters.order_by, and ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues.gantt_chart.display_filters.order_by from "priority" to "-priority" are consistent with the PR objective and the modifications made in other parts of the file. This will ensure that the sorting logic related to issue prioritization is updated comprehensively across various display filter configurations.

Also applies to: 360-360, 386-386, 432-432, 456-456

web/core/store/issue/helpers/base-issues.store.ts (2)

1747-1750: LGTM!

The changes correctly sort the issues by priority in ascending order of priority index, which aligns with the "-priority" key indicating descending priority order.


Line range hint 1751-1757: LGTM!

The changes correctly reverse the sorting order for the "priority" key to sort issues in ascending priority order. This aligns with the PR objective.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

coderabbitai[bot] avatar Sep 12 '24 09:09 coderabbitai[bot]