Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Sammers21/wow-pla
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Sep 28, 2023
2 parents d94e8c7 + d69ee21 commit f5c5046
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/components/Profile/Alts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const Alts = ({ isMobile, alts }) => {
};

const renderNumber = (number) => {
if(number === undefined) {
number = 0;
}
let color = ratingToColor(number);
return <Typography color={color}>{number}</Typography>;
};
Expand All @@ -59,7 +62,10 @@ const Alts = ({ isMobile, alts }) => {
console.error("Unknown bracket: " + bracket);
}
let found = (alt?.brackets ?? []).filter(findQuery);
let max = Math.max(...found.map((bracket) => bracket.rating));
let max = 0;
if(found.length > 0) {
max = Math.max(...found.map((bracket) => bracket.rating));
}
return renderNumber(max);
};

Expand Down Expand Up @@ -118,6 +124,11 @@ const Alts = ({ isMobile, alts }) => {
alt[bracket.bracket_type] = bracket.rating;
}
});
["SHUFFLE", "ARENA_2v2", "ARENA_3v3", "BATTLEGROUNDS"].forEach((bracket) => {
if(alt[bracket] === undefined) {
alt[bracket] = 0;
}
});
return alt;
});

Expand Down

0 comments on commit f5c5046

Please sign in to comment.