diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 025218424..f0703d1f0 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -11,14 +11,14 @@ class HomeworkCommonsController < ApplicationController before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results, :code_review_detail, :show_comment, :settings, :works_list, :update_settings, :reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation, - :update_score, :update_student_score, :get_challenge_detail] + :update_score, :update_student_score] before_action :user_course_identity before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer, :update_student_score] before_action :teacher_allowed, only: [:new, :edit, :create, :update, :shixuns, :subjects, :create_shixun_homework, :publish_homework, :end_homework, :set_public, :choose_category, :move_to_category, :choose_category, :create_subject_homework, :multi_destroy, :group_list, :homework_code_repeat, :code_review_results, :code_review_detail, :update_explanation, :update_settings, - :add_to_homework_bank, :publish_groups, :end_groups, :get_challenge_detail] + :add_to_homework_bank, :publish_groups, :end_groups] before_action :require_id_params, only: [:set_public, :multi_destroy, :publish_homework, :end_homework, :move_to_category, :add_to_homework_bank] before_action :course_manager, only: [:alter_name] @@ -1346,13 +1346,6 @@ class HomeworkCommonsController < ApplicationController end - # 代码查重关卡详情 - def get_challenge_detail - @student_work = @homework.student_works.find_by(user_id: params[:user_id]) - @user = @student_work.user - tip_exception("当前用户无作品可以显示") if @student_work.nil? - end - # 代码查重代码的详情 def code_review_detail @student_work = @homework.student_works.find_by(user_id: params[:user_id]) diff --git a/app/views/homework_commons/code_review_detail.json.jbuilder b/app/views/homework_commons/code_review_detail.json.jbuilder index 916e77c0f..4ebabf20a 100644 --- a/app/views/homework_commons/code_review_detail.json.jbuilder +++ b/app/views/homework_commons/code_review_detail.json.jbuilder @@ -1,3 +1,21 @@ +json.course_id @course.id +json.course_name @course.name +json.homework_common_id @homework.id +json.homework_common_name @homework.name +json.work_name @student_work.name +json.username @user.full_name +json.user_id @user.id +json.user_login @user.login + +json.work_score @student_work.work_score +if @student_work.ultimate_score + json.adjust_score @student_work.work_score < 0 ? 0 : number_with_precision(@student_work.work_score, precision: 1) +else + json.final_score @student_work.final_score + json.late_penalty @student_work.late_penalty + json.score @student_work.work_score < 0 ? 0 : number_with_precision(@student_work.work_score, precision: 1) +end + json.challenge_list do json.array! @challenges do |challenge| json.id challenge[:id] diff --git a/app/views/homework_commons/get_challenge_detail.json.jbuilder b/app/views/homework_commons/get_challenge_detail.json.jbuilder deleted file mode 100644 index d3d6c2c1e..000000000 --- a/app/views/homework_commons/get_challenge_detail.json.jbuilder +++ /dev/null @@ -1,17 +0,0 @@ -json.course_id @course.id -json.course_name @course.name -json.homework_common_id @homework.id -json.homework_common_name @homework.name -json.work_name @student_work.name -json.username @user.full_name -json.user_id @user.id -json.user_login @user.login - -json.work_score @student_work.work_score -if @student_work.ultimate_score - json.adjust_score @student_work.work_score < 0 ? 0 : number_with_precision(@student_work.work_score, precision: 1) -else - json.final_score @student_work.final_score - json.late_penalty @student_work.late_penalty - json.score @student_work.work_score < 0 ? 0 : number_with_precision(@student_work.work_score, precision: 1) -end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 395ce0ef9..cf5bad608 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -337,7 +337,6 @@ Rails.application.routes.draw do post :homework_code_repeat get :code_review_results get :code_review_detail - get :get_challenge_detail post :update_explanation get :show_comment get :settings