Skip to content

[ability draft] Negative percentages are sorted incorrectly #55

@p-fiftythree

Description

@p-fiftythree

Issue

Negative percentages are sorted incorrectly in various table views on windrun.io.

Impacted Pages:

Page Screenshot
windrun.io/abilities (value column) Screenshot 2024-03-19 at 9 27 53 AM
windrun.io/ability-high-skill (delta-win% column) Screenshot 2024-03-19 at 10 21 13 AM
windrun.io/ability-pairs (synergy-delta column) Screenshot 2024-03-19 at 9 29 35 AM
windrun.io/heroes/<hero-id> (value column) Screenshot 2024-03-19 at 10 21 53 AM

The buggy function appears to be present on all table pages, but not all have a column with negative percentage values.

Cause

The percSorter function is incorrectly parsing negative percentages. The culprit is the replace("-", "0.0"), which is mangling negative percentages. For example, "-10.1%" will be incorrectly converted to "0.010.1", which parseFloat evaluates as 0.01.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions