Friday, March 28, 2025
1 change · saas-17.4
Resolved issues and error corrections
A scoring edge case in live survey sessions could crash the leaderboard when a participant answered correctly and speed rewards were enabled. The fix prevents the calculation from dividing by zero, so users can continue viewing leaderboard results reliably.
Original PR description
Reproduce: 1. Make a scored live session survey with speed reward 2. Add a single choice question with a 1-point answer 3. Create a live session 4. Join with one participant 5. Play the survey, have the participant answer correctly 6. Proceed to leaderboard and expect a crash. With the change of `survey.user.input`'s `scoring_total` digits of 8d436c5c, the total score of a user and the answer score for the first question were not exactly the same anymore. Therefore, in `Survey._prepare_leaderboard_values` `scoring_total` was not exactly 0 but a small number (<0.01), and `max_score`'s computation in `user_input_session_leaderboard` template was therefore not replacing `scoring_total` with `1`, and dividing by `max_score` rounded to 0 in `t-set="width_ratio"` caused the crash. We are choosing this fix because it does not rely on updating templates in dbs. Task-4655784