You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When comparing two users and the lower-scoring user has a finalScore of 0, the winner banner can show Leads by 0% even though the score difference is positive. The issue comes from percentage calculations that avoid division by zero by returning 0, which makes the UI look like there is no lead.
Context
app/api/compare/route.ts sets percentageDifference to 0 when overallLoser.finalScore is 0.
components/result-dashboard.tsx recomputes winnerDiffPct and also falls back to 0 when loserUser.finalScore is 0.
The language-focused winner path has the same pattern for languageWinner.percentageDifference.
Tasks
Define the expected display behavior when the loser score is 0 and the winner score is greater than 0 (for example, show N/A, +{points} points, or another explicit non-percentage label).
Update the compare API winner payload so zero-baseline comparisons do not report a misleading 0% lead.
Update the winner banner in components/result-dashboard.tsx to render the zero-baseline state correctly.
Apply the same behavior to language-focused winner comparisons.
Add tests for cases where one user has a positive final score and the other has 0.
Tip
🚀 Want to contribute?
Comment assign me to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨
When comparing two users and the lower-scoring user has a
finalScoreof0, the winner banner can showLeads by 0%even though the score difference is positive. The issue comes from percentage calculations that avoid division by zero by returning0, which makes the UI look like there is no lead.Context
app/api/compare/route.tssetspercentageDifferenceto0whenoverallLoser.finalScoreis0.components/result-dashboard.tsxrecomputeswinnerDiffPctand also falls back to0whenloserUser.finalScoreis0.languageWinner.percentageDifference.Tasks
0and the winner score is greater than0(for example, showN/A,+{points} points, or another explicit non-percentage label).0%lead.components/result-dashboard.tsxto render the zero-baseline state correctly.0.Tip
🚀 Want to contribute?
Comment
assign meto be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨