竞赛打分保留4位小数

This commit is contained in:
xiaoxiaoqiong 2022-05-18 11:42:53 +08:00
parent ef33193f01
commit f93c1dff0b
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class CompetitionAutoScoreJob < ApplicationJob
data = JSON.parse response.body
status = data[:status].to_s == "0" ? 2 : 3
if data["status"].to_s == "0"
score = data["score"].to_f
score = format("%.4f", data["score"].to_f).to_f
competition_score = competition_team.competition_scores.present? ? competition_team.competition_scores.first : competition_team.competition_scores.new
competition_score.score = score
competition_score.competition_id = competition_team.competition_id