Skip to content

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Apr 5, 2025

Reproduce:

  1. Make a scored live session survey
  2. Add a single choice question with a <0.5 point answer (or < 1 with speed reward)
  3. Create a live session
  4. Join with one participant
  5. Play the survey, have the participant answer correctly (after half the time for speed reward if that case is tested)
  6. Proceed to leaderboard and expect a crash.

This happens because when max_score or max_score_question are <= 0.5, divisions by round(<=.5) are divisions by 0.

Using 3 digits for rounding has two advantages:

  • It is very unlikely that an answer will have a value below 0.0006 (not 0 - that case is supported- but rounds to 0).
  • It makes the template resilient to differences in precisions used for the various numbers (relevant in 17.4 where answer_score and scoring_total can be different by <0.01).

Task-4655784

Forward-Port-Of: #204907
Forward-Port-Of: #203988

Reproduce:
1. Make a scored live session survey
2. Add a single choice question with a <0.5 point answer (or
  < 1 with speed reward)
3. Create a live session
4. Join with one participant
5. Play the survey, have the participant answer correctly
  (after half the time for speed reward if that case is tested)
6. Proceed to leaderboard and expect a crash.

This happens because when `max_score` or `max_score_question` are
<= 0.5, divisions by round(<=.5) are divisions by 0.

Using 3 digits for rounding has two advantages:
* It is very unlikely that an answer will have a value below 0.0006
  (not 0 - that case is supported- but rounds to 0).
* It makes the template resilient to differences in precisions used
  for the various numbers (relevant in 17.4 where `answer_score`
  and `scoring_total` can be different by <0.01).

Note that we stick to the minimal diff and do not change the
values shown to not introduce decimal points showing up if
they weren't shown before.

Task-4655784

X-original-commit: f538369
@robodoo
Copy link
Contributor

robodoo commented Apr 5, 2025

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Apr 5, 2025

This PR targets saas-18.2 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Apr 5, 2025
@C3POdoo C3POdoo added the RD research & development, internal work label Apr 5, 2025
robodoo pushed a commit that referenced this pull request Apr 5, 2025
Reproduce:
1. Make a scored live session survey
2. Add a single choice question with a <0.5 point answer (or
  < 1 with speed reward)
3. Create a live session
4. Join with one participant
5. Play the survey, have the participant answer correctly
  (after half the time for speed reward if that case is tested)
6. Proceed to leaderboard and expect a crash.

This happens because when `max_score` or `max_score_question` are
<= 0.5, divisions by round(<=.5) are divisions by 0.

Using 3 digits for rounding has two advantages:
* It is very unlikely that an answer will have a value below 0.0006
  (not 0 - that case is supported- but rounds to 0).
* It makes the template resilient to differences in precisions used
  for the various numbers (relevant in 17.4 where `answer_score`
  and `scoring_total` can be different by <0.01).

Note that we stick to the minimal diff and do not change the
values shown to not introduce decimal points showing up if
they weren't shown before.

Task-4655784

closes #204913

X-original-commit: f538369
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Florian Charlier (flch) <flch@odoo.com>
@robodoo robodoo closed this Apr 5, 2025
@fw-bot fw-bot deleted the saas-18.2-16.0-survey-fix-leaderboard-division-by-zero-flch-427856-fw branch April 12, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants