Skip to content

Commit

Permalink
Merge pull request #242 from moonstream-to/heat-map-fix
Browse files Browse the repository at this point in the history
heat map fix
  • Loading branch information
Anton-Mushnin authored Apr 4, 2024
2 parents ba3bc9e + 5e0fd04 commit 47ef87d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions web/src/components/atbat/TokenCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ const TokenCard = ({ token, isPitcher }: { token: Token; isPitcher: boolean }) =
const API_URL = "https://api.fullcount.xyz/pitch_distribution";
const res = await axios.get(`${API_URL}/${token.address}/${token.id}`);
const counts = new Array(25).fill(0);
res.data.pitch_distribution.forEach(
(l: PitchLocation) => (counts[l.pitch_vertical * 5 + l.pitch_horizontal] = l.count),
);
res.data.pitch_distribution.forEach((l: PitchLocation) => {
counts[l.pitch_vertical * 5 + l.pitch_horizontal] =
counts[l.pitch_vertical * 5 + l.pitch_horizontal] + l.count;
});
const total = counts.reduce((acc, value) => acc + value);
const fast = res.data.pitch_distribution.reduce(
(acc: number, value: { pitch_speed: 0 | 1; count: number }) =>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/playing/HeatMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const HeatMap = ({
>
{showMode !== 0 && (
<Text fontSize={"9px"} color={"black"} fontWeight={"400"}>
{showMode === 1 ? (rates[index] * 100).toFixed(2) : counts[index]}
{showMode === 2 ? (rates[index] * 100).toFixed(2) : counts[index]}
</Text>
)}
</Box>
Expand Down

0 comments on commit 47ef87d

Please sign in to comment.