Skip to content

Comments

[WEB-2681] fix: module progress indicator#5842

Merged
pushya22 merged 3 commits intopreviewfrom
fix-module-progress-indicator
Oct 21, 2024
Merged

[WEB-2681] fix: module progress indicator#5842
pushya22 merged 3 commits intopreviewfrom
fix-module-progress-indicator

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Oct 16, 2024

Changes:

This PR fixes the module progress indicator. Previously, when the estimate points were enabled, the progress was being calculated based on those points. I have made the necessary changes to ensure that progress is now calculated based on the issue state as intended.

Reference:

[WEB-2681]

Summary by CodeRabbit

  • New Features

    • Simplified completion percentage calculation for module list items, now based solely on completed and cancelled issues.
    • Updated terminology in the UI to consistently refer to "Issues" instead of "Points."
  • Bug Fixes

    • Removed unnecessary conditional logic related to project estimates, enhancing clarity and reliability of completion data.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes involve the ModuleListItem and ModuleCardItem components, where the useProjectEstimates hook has been removed from both. The completion percentage calculation in ModuleListItem has been simplified to rely solely on completed and cancelled issues relative to total issues. Similarly, ModuleCardItem has seen a simplification in the logic for calculating issue counts, removing any conditions based on estimates. Import statements have been adjusted for clarity, but the overall structure, props, and rendering logic of both components remain unchanged.

Changes

File Path Change Summary
web/core/components/modules/module-list-item.tsx Removed useProjectEstimates import and associated logic; simplified completion percentage calculation.
web/core/components/modules/module-card-item.tsx Removed useProjectEstimates import; simplified logic for calculating total and completed issues; adjusted terminology in UI.

Suggested labels

🐛bug, 🌟enhancement

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham

Poem

In the meadow where we play,
Changes hop along the way.
Estimates now take a rest,
Completion's clearer, we feel blessed!
With every issue, we will cheer,
Simplified paths, let’s give a cheer! 🐇✨


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 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
Contributor

@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: 1

🧹 Outside diff range and nitpick comments (1)
web/core/components/modules/module-list-item.tsx (1)

42-43: Suggestion: Add explanatory comment for progress calculation

While the new calculation is straightforward, it would be beneficial to add a brief comment explaining the rationale behind including both completed and cancelled issues in the progress calculation. This will enhance code maintainability and clarify the business logic for future developers.

Consider adding a comment like this:

// Calculate completion percentage based on completed and cancelled issues
// relative to total issues, as per updated business requirements
const completionPercentage =
  ((moduleDetails.completed_issues + moduleDetails.cancelled_issues) / moduleDetails.total_issues) * 100;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9b85306 and 5dc9720.

📒 Files selected for processing (1)
  • web/core/components/modules/module-list-item.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (2)
web/core/components/modules/module-list-item.tsx (2)

16-17: LGTM: Import removal aligns with PR objective

The removal of the useProjectEstimates import is consistent with the PR's goal of calculating progress based on issue state rather than estimate points. This change simplifies the component's dependencies and aligns with the new implementation.


Line range hint 1-114: Summary: Changes successfully implement PR objectives

The modifications to the ModuleListItem component successfully implement the PR objectives by:

  1. Removing the dependency on estimate points for progress calculation.
  2. Simplifying the completion percentage calculation to use issue states.
  3. Maintaining the overall structure and functionality of the component.

These changes improve code maintainability and align the progress calculation with the intended design. The component should now accurately reflect module progress based on issue states rather than estimate points.

🧰 Tools
🪛 Biome

[error] 45-45: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

Comment on lines +42 to +43
const completionPercentage =
((moduleDetails.completed_issues + moduleDetails.cancelled_issues) / moduleDetails.total_issues) * 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Verification Completed: Simplified Calculation Consistent Across Codebase

The updated completion percentage calculation using completed_issues, cancelled_issues, and total_issues is consistently applied across the codebase, aligning with the PR objective to simplify and enhance maintainability.

However, there are still several references to estimate_point and related variables. Please ensure that no progress calculations are still dependent on estimate points to maintain uniform behavior.

  • Review instances of estimate_point to confirm they do not impact progress calculations.
  • If estimate-based calculations are no longer needed, consider removing or refactoring them accordingly.
🔗 Analysis chain

LGTM: Simplified completion percentage calculation

The new calculation for completionPercentage correctly implements the PR objective by basing progress on issue state (completed and cancelled issues) rather than estimate points. This change simplifies the logic and improves maintainability.

To ensure consistency across the codebase, please run the following script:

This will help identify any other locations where similar calculations might need to be updated for consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of module progress calculation

# Search for similar progress calculations in other files
rg --type typescript --type javascript -e 'completed_issues' -e 'cancelled_issues' -e 'total_issues' --glob '!**/module-list-item.tsx'

# Search for any remaining uses of estimate points for progress calculation
rg --type typescript --type javascript -e 'estimate_point' -e 'useProjectEstimates'

Length of output: 282


Script:

#!/bin/bash
# Description: Check for other occurrences of module progress calculation with corrected file types

# Search for similar progress calculations in other files
rg --type ts --type tsx --type js --type jsx -e 'completed_issues' -e 'cancelled_issues' -e 'total_issues' --glob '!**/module-list-item.tsx'

# Search for any remaining uses of estimate points for progress calculation
rg --type ts --type tsx --type js --type jsx -e 'estimate_point' -e 'useProjectEstimates'

Length of output: 280


Script:

#!/bin/bash
# Description: Check for other occurrences of module progress calculation using file extensions

# Search for similar progress calculations in other files
rg -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx' 'completed_issues|cancelled_issues|total_issues' --glob '!**/module-list-item.tsx'

# Search for any remaining uses of estimate points for progress calculation
rg -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx' 'estimate_point|useProjectEstimates'

Length of output: 29494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants