fix: show standard points when custom points match standard value in broadcast player results#2943
Conversation
veloce
left a comment
There was a problem hiding this comment.
Thanks. Will approve once the tests are re-written like explained in the code comment.
|
|
||
| /// Replicates the display logic from [_GameResultListTile] in | ||
| /// broadcast_player_results_screen.dart to verify it matches the web behavior. | ||
| String displayedPoints({ |
There was a problem hiding this comment.
This is not a good way to test that. We want to actually test the real function used in _GameResultListTile, not a replicated one. Unit tests are fine if they actually test the real function, but in my opinion widgets tests are better since the flutter test framework makes it easy to write them.
This test suite should be done in a broadcast_player_results_screen_test.dart, and we need widget tests that test the actual content displayed on screen. This is how all the tests work in this repository.
There was a problem hiding this comment.
I think the rewrite should be ready for review!
…broadcast player results When a broadcast round has custom scoring (e.g. Norway Chess armageddon), games where custom points equal 0 (e.g. a classical draw that goes to armageddon) were incorrectly showing "0" instead of "½". The web correctly shows the standard result by checking whether custom points differ from the standard value. Align mobile logic with the web by comparing custom points against the standard numeric value instead of a hardcoded 0.5. Fixes lichess-org#2940 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Tests the condition that decides when to show custom points vs standard points in broadcast player results. Covers all combinations including the Norway Chess armageddon scenario from lichess-org#2940 where a draw with 0 custom points must display ½ instead of 0. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…s display Address review feedback: exercise _GameResultListTile directly via BroadcastPlayerResultsScreen rendering instead of duplicating its display logic in a unit test. Mock at the HTTP layer per CLAUDE.md.
|
@CloudyDino should this also be changed for the colored result on the broadcast screen as well? I think the app handles it differently than web |
Hey @CloudyDino just in case this one slipped through. I can create a separate issue ticket if necessary. Should it be changed here too to match web? |
|
Sorry I only saw this PR today. Concerning your table 1st row, web showing "½" when the points scored was 0 was definitely not intended. We always want to show the actual points scored. |
Hi @allanjoseph98 any chance to ask if you know how to properly calculate the denominator? I see for example for chesscom they say 9.5 is the # of games for Magnus. It appears this is because he's played 3 normal point rounds (up to 9 points) and one tiebreak round (worth up to 0.5 a point) but since the tiebreaks are not necessarily evenly distributed (for example keymer has all 3 tiebreak rounds so his is 3x3.5 for 10.5) |
|
Another question too (so I posted 2 today :) ) For a draw in Armageddon in Norway
Bibsara-divya for round 3 women and Westley/keymer for rounds 3 men are good references games for this |
|
In my mind I view part 1 as the score out of the optimal score. For example in a normal 0-1/2-1 scoring format, if you score 8.5/9 you scored 8.5 out of 9 possible points I respect your opinion so what are your thoughts on this suggestion. I thinks it's a little more effective than what we have currently For part 2, I made some edits. Is all that I said worth a ticket in some way. With the colors and also the decimal vs fractional inconsistencies. I edited the comment to be a little clearer becuase sometimes I was taking the "games in this tournament list" and other times about the game result screen. Lastly, I have one more suggestion to run by you first before potentially creating a Lila ticket and if that passes pushing for it on app too. 1 2 3 3a 4 |
|
Thanks, created issue on 3 and will standby on 2 For 1, I do hope we still keep some denominator regardless. Even if it's eventually chesscom format that works (understood it's not a priority), but lmk if you want me to create a ticket |
Summary
Fixes #2940
In broadcasts with custom scoring (e.g. Norway Chess armageddon format), individual game results in the player results screen could show incorrect point values compared to the web.
The root cause was in the display condition for custom vs standard points. The mobile app checked
customPoints != 0.5to decide whether to show custom points, while the web checks whether custom points are non-zero AND differ from the standard points value (link: lila/blob/master/ui/analyse/src/study/relay/relayPlayers.ts#L449). This caused a draw with 0 custom points (e.g. a classical draw in Norway Chess where points are awarded via the armageddon game instead) to display "0" on mobile instead of "½" as shown on the web.Changes
valuegetter toBroadcastPointsthat returns its numeric equivalent (1.0, 0.5, 0.0)Before/After