fix: leaderboard loading issue

This commit is contained in:
Timothy Jaeryang Baek 2025-07-30 14:18:36 +04:00
parent 3ab10c6758
commit f027df06d1
2 changed files with 16 additions and 11 deletions

View File

@ -355,17 +355,20 @@
</div> </div>
</div> </div>
</td> </td>
<td class="px-3 py-1 text-right font-medium text-gray-900 dark:text-white w-max">
<div class=" flex justify-end"> {#if feedback?.data?.rating}
{#if feedback.data.rating.toString() === '1'} <td class="px-3 py-1 text-right font-medium text-gray-900 dark:text-white w-max">
<Badge type="info" content={$i18n.t('Won')} /> <div class=" flex justify-end">
{:else if feedback.data.rating.toString() === '0'} {#if feedback?.data?.rating.toString() === '1'}
<Badge type="muted" content={$i18n.t('Draw')} /> <Badge type="info" content={$i18n.t('Won')} />
{:else if feedback.data.rating.toString() === '-1'} {:else if feedback?.data?.rating.toString() === '0'}
<Badge type="error" content={$i18n.t('Lost')} /> <Badge type="muted" content={$i18n.t('Draw')} />
{/if} {:else if feedback?.data?.rating.toString() === '-1'}
</div> <Badge type="error" content={$i18n.t('Lost')} />
</td> {/if}
</div>
</td>
{/if}
<td class=" px-3 py-1 text-right font-medium"> <td class=" px-3 py-1 text-right font-medium">
{dayjs(feedback.updated_at * 1000).fromNow()} {dayjs(feedback.updated_at * 1000).fromNow()}

View File

@ -151,6 +151,8 @@
} }
feedbacks.forEach((feedback) => { feedbacks.forEach((feedback) => {
if (!feedback?.data?.model_id || !feedback?.data?.rating) return;
const modelA = feedback.data.model_id; const modelA = feedback.data.model_id;
const statsA = getOrDefaultStats(modelA); const statsA = getOrDefaultStats(modelA);
let outcome: number; let outcome: number;