The root of the problem is in how the baseline rows are inserted into the Leaderboard. In calculate_leaderboard_service.rb#create_leaderboard, score and secondary_score are set to submission.score_display and submission.secondary_score_display respectively. However for a baseline those same values are set to submission.score and submission.secondary_score. The score_display values are calculated in truncate_scores, which operates over all submissions with the appropriate challenge_round_id, so it should be safe to use those values with the baseline submissions, but it is unclear to me if that is desired behavior.
In this PR it only fixes the display of the baseline score to account for the precision in the challenge round. It does add one minor tweak so that all scores will show N digits of precision instead of the current behavior where for example 1.5 shows as 1.5 instead of 1.500 for N=3.
The root of the problem is in how the baseline rows are inserted into the Leaderboard. In
calculate_leaderboard_service.rb#create_leaderboard
, score and secondary_score are set tosubmission.score_display
andsubmission.secondary_score_display
respectively. However for a baseline those same values are set tosubmission.score
andsubmission.secondary_score
. Thescore_display
values are calculated intruncate_scores
, which operates over all submissions with the appropriatechallenge_round_id
, so it should be safe to use those values with the baseline submissions, but it is unclear to me if that is desired behavior.In this PR it only fixes the display of the baseline score to account for the precision in the challenge round. It does add one minor tweak so that all scores will show N digits of precision instead of the current behavior where for example![leaderboard](https://user-images.githubusercontent.com/1289794/49305384-6aae1000-f4cf-11e8-9294-253d65868f6b.jpg)
1.5
shows as1.5
instead of1.500
forN=3
.