Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/Heroes/rankColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ const generateTurboTabColumns = (strings: Strings) => {
percentBarsWithValue: (row: Row) =>
decimalToCount(row.winRateTurbo, row.turbo_picks),
},
{
displayName: strings.hero_turbo_win_rate_diff,
field: "winRateTurboVsPub",
sortFn: (row: Row) => row.winRateTurbo - row.winRatePub,
displayFn: (_row: Row, _col: string, value: any) => {
if (!Number.isFinite(value)) {
return "–";
}
const diff = value * 100;
return `${diff > 0 ? "+" : ""}${diff.toFixed(1)}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we show - if it's negative?

@timoHaario timoHaario Oct 2, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

toFixed returns a string and already returns negative values with the minus sign, this just adds the + for positive numbers.

However there's a small possible issue with the implementation above. Now the function first chooses the sign and then rounds the number, which for numbers close to 0 would result with either +0.0 or -0.0 . This could be a bug or a feature; user could read -0.0 as something that's slightly under zero (more informative), but if you want to keep it simpler so that each rounded value has the same representation, you'd want to round first and then choose the sign, like following:

displayFn: (_row: Row, _col: string, value: any) => {
    if (!Number.isFinite(value)) {
      return "–";
    }
    const diff = Number((value * 100).toFixed(1)) || 0;
    return `${diff > 0 ? "+" : ""}${diff.toFixed(1)}`;
  },

},
},
];

return combinedColumns;
Expand Down
1 change: 1 addition & 0 deletions src/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
"hero_win_rate": "Pro Win%",
"hero_turbo_pick_rate": "Turbo Pick %",
"hero_turbo_win_rate": "Turbo Win %",
"hero_turbo_win_rate_diff": "Win % vs Normal",
"hero_5000_pick_rate": ">5K P%",
"hero_5000_win_rate": ">5K W%",
"hero_4000_pick_rate": "4K P%",
Expand Down
1 change: 1 addition & 0 deletions src/lang/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@
"hero_win_rate": "Победы, %",
"hero_turbo_pick_rate": "Пик в турбо, %",
"hero_turbo_win_rate": "Победы в турбо, %",
"hero_turbo_win_rate_diff": "Разница побед (Turbo – обычная), %",
"hero_5000_pick_rate": ">5K Пик, %",
"hero_5000_win_rate": ">5K Победы, %",
"hero_4000_pick_rate": "4K Пик, %",
Expand Down