From 9e6d6ab36e12db2980e39583eb07f5e73d7058c0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 8 Nov 2019 15:29:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E5=88=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_works_controller.rb | 2 +- app/views/student_works/shixun_work_report.json.jbuilder | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 58406467d..dda677802 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -721,7 +721,7 @@ class StudentWorksController < ApplicationController challenge_setting = @homework.homework_challenge_settings.find_by(challenge_id: params[:challenge_id]) challenge = challenge_setting&.challenge tip_exception("不能小于零") if params[:score].to_i < 0 - tip_exception("不能大于关卡分值:#{challenge_setting.score}分") if challenge_setting.score < params[:score].to_i + tip_exception("不能大于关卡分值:#{challenge_setting.score}分") if challenge_setting && challenge_setting.score < params[:score].to_i ActiveRecord::Base.transaction do begin diff --git a/app/views/student_works/shixun_work_report.json.jbuilder b/app/views/student_works/shixun_work_report.json.jbuilder index f6ca05bec..cda78d93c 100644 --- a/app/views/student_works/shixun_work_report.json.jbuilder +++ b/app/views/student_works/shixun_work_report.json.jbuilder @@ -9,15 +9,15 @@ if @shixun json.overall_appraisal @work.overall_appraisal json.myself_experience @work.myshixun.try(:total_score).to_i json.total_experience @shixun.all_score - json.work_score number_with_precision @work.work_score, precision: 1 + json.work_score number_with_precision @work.work_score.to_f.round(2), precision: 1 json.all_work_score number_with_precision 100, precision: 1 json.time_consuming @work.myshixun_consume json.evaluate_count @user_evaluate_count.to_i if @homework.work_efficiency json.eff_score_full number_with_precision @homework.eff_score, precision: 1 - json.eff_score number_with_precision @work.eff_score, precision: 1 + json.eff_score number_with_precision @work.eff_score.to_f.round(2), precision: 1 json.challenge_score_full number_with_precision (100 - @homework.eff_score), precision: 1 - json.challenge_score number_with_precision @work.final_score, precision: 1 + json.challenge_score number_with_precision @work.final_score.to_f.round(2), precision: 1 end # 阶段成绩 @@ -53,7 +53,7 @@ if @shixun json.username @user.real_name json.student_id @user.student_id json.image_url url_to_avatar(@user) - json.complete_count @work.myshixun&.passed_count + json.complete_count @work.myshixun&.passed_count.to_i json.challenges_count @shixun.challenges_count json.efficiency @homework.work_efficiency ? number_with_precision(@work.efficiency, precision: 2) : nil json.max_efficiency @homework.work_efficiency ? number_with_precision(@homework.max_efficiency, precision: 2) : nil