Skip to content

bug: InsightsList incorrectly favors User 1 when metrics are tied #268

Open
Beehtrix/DevImpact
#1

Description

@O2sa

In src/features/comparison/components/insights-list.tsx lines 46-69:

const repoLeader = user1.repoScore >= user2.repoScore ? user1 : user2;
const prLeader = user1.prScore >= user2.prScore ? user1 : user2;
const contributionLeader = user1.contributionScore >= user2.contributionScore ? user1 : user2;

When both developers have equal scores (for example, both have 0 PR score or matching repo scores), the >= check automatically assigns user1 as the leader. As a result, user1 is credited with a strength in that category, and user2 is given a recommendation to improve.

Motivation

Displaying asymmetric insights when two scores are identical is incorrect and misleading.

Tasks

  • Check for score equality (user1.repoScore === user2.repoScore).
  • Only award category strengths when a developer strictly exceeds the other (>).
  • If tied, either do not award a strength or display a balanced tied note.
  • Update or add tests in src/features/comparison/tests/insights-list.test.tsx.

Files to Check

  • src/features/comparison/components/insights-list.tsx
  • src/features/comparison/tests/insights-list.test.tsx

Tip

🚀 Want to contribute?
Comment assign me to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨

Activity

  1. added
    bug
    good first issue
    on Oct 24, 2026
  2. sarmad-jalil commented on Oct 25, 2026

    @sarmad-jalil

    Hi! I'd like to work on this issue. Could you please assign it to me? Thanks!

  3. github-actions commented on Oct 25, 2026

    @github-actions

    🎉 Issue assigned to @sarmad-jalil! Happy coding!

  4. O2sa commented on Dec 1, 2026

    @O2sa
    OwnerAuthor

    This issue still not resolved.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    beginner friendlybugeasygood first issuetypescript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions