cornucopia icon indicating copy to clipboard operation
cornucopia copied to clipboard

fix: use rounds_played directly in handle_info for finished games

Open immortal71 opened this issue 8 months ago • 11 comments

Summary

Fixes #2548.

handle_info/2 in GameLive.Show always set requested_round = updated_game.rounds_played + 1 when a game:updated broadcast was received, even for games that are already finished. This caused the finished-game summary page to show a non-existent round.

handle_params/3 already handled this correctly with a finished_at check. This PR applies the same logic to handle_info/2.

Changes

  • copi.owasp.org/lib/copi_web/live/game_live/show.ex: mirror handle_params finished-game check inside handle_info
  • copi.owasp.org/test/copi_web/live/game_live/show_test.exs: add test verifying requested_round stays at rounds_played (not +1) after a broadcast for a finished game

immortal71 avatar Mar 07 '26 14:03 immortal71

@sydseter is this good to go ???

immortal71 avatar Mar 07 '26 19:03 immortal71

Hello @immortal71, This is a solid PR that addresses a specific UI bug where finished games would incorrectly show a non-existent round number when receiving game update broadcasts. The fix is straightforward and follows the existing pattern already implemented in handle_params/3, making it a clean and consistent solution. You also took the opportunity to significantly improve test coverage across the codebase, which is always valuable. However, the PR description is misleading as it only mentions two files but actually includes additional bug fixes in convert_capec.py and extensive test additions across multiple modules. The description should be updated to accurately reflect all the changes being introduced.

Suresh-Krishna-P avatar Mar 08 '26 09:03 Suresh-Krishna-P

@sydseter just here for follow up,..... is this good to go

immortal71 avatar Mar 10 '26 17:03 immortal71

@immortal71 Looks good, but there are some merge conflicts here as well.

sydseter avatar Mar 18 '26 12:03 sydseter

@sydseter is this good to go ?

immortal71 avatar Apr 19 '26 15:04 immortal71

Please remove all the # coveralls-ignore comments.

sydseter avatar Apr 24 '26 05:04 sydseter

Please do not ignore coveralls.

okay

immortal71 avatar Apr 24 '26 16:04 immortal71

@sydseter is this good to go ?

immortal71 avatar Apr 25 '26 01:04 immortal71

wait i think there is one conflict

immortal71 avatar Apr 25 '26 01:04 immortal71

@sydseter now is it okay ?

immortal71 avatar Apr 25 '26 02:04 immortal71

@immortal71 the code has conflicts

sydseter avatar May 29 '26 13:05 sydseter