-
Notifications
You must be signed in to change notification settings - Fork 24
Closed as not planned
Labels
Description
Fix this crash
[Backend]: File "/app/questions/services/movement.py", line 141, in calculate_period_movement_for_questions
[Backend]: question_movement_map[question] = serialize_question_movement(
[Backend]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Backend]: File "/app/questions/serializers/common.py", line 870, in serialize_question_movement
[Backend]: divergence = prediction_difference_for_sorting(
[Backend]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Backend]: File "/app/utils/the_math/measures.py", line 100, in prediction_difference_for_sorting
[Backend]: return sum([(p - q) * np.log2(p / q) for p, q in zip(p1, p2)])
[Backend]: ~~^~~
[Backend]: TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Sometimes this serialization crashes and makes the whole questions page fail to load. Fix the crash so it handles gracefully cases when it cannot compute the movement.