fix self-stats always showing 0 in cmpr

This commit is contained in:
zkldi
2021-12-01 00:56:29 +00:00
parent 678ecf67df
commit 3ecc2a4bcf
2 changed files with 28 additions and 17 deletions
@@ -72,6 +72,7 @@ export default function UGPTStatContainer({
return (
<StatDisplay
reqUser={reqUser}
game={game}
playtype={playtype}
statData={data.data}
+27 -17
View File
@@ -368,11 +368,17 @@ export function GetStatName(
export function StatDisplay({
statData,
reqUser,
compareData,
game,
playtype,
}: { statData: UGPTPreferenceStatsReturn; compareData?: UGPTPreferenceStatsReturn } & GamePT) {
}: {
statData: UGPTPreferenceStatsReturn;
compareData?: UGPTPreferenceStatsReturn;
reqUser: PublicUserDocument;
} & GamePT) {
const { stat, result, related } = statData;
const { user } = useContext(UserContext);
if (stat.mode === "chart") {
const { song, chart } = related as { song: SongDocument; chart: ChartDocument };
@@ -388,14 +394,16 @@ export function StatDisplay({
{UppercaseFirst(stat.property)}:{" "}
{FormatPropertyGTE(game, playtype, stat.property, result.value)}
</h4>
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
{user && user.id !== reqUser.id && (
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
)}
</>
</Card>
);
@@ -426,14 +434,16 @@ export function StatDisplay({
<small className="text-muted">/{result.outOf}</small>
</h4>
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
{user && user.id !== reqUser.id && (
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
)}
</>
</Card>
);