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]
    json.position challenge[:position]
    json.subject challenge[:subject]
    json.end_time challenge[:end_time]
    json.final_score challenge[:final_score]
    json.username challenge[:username]
    json.all_score challenge[:all_score]
    json.copy_username challenge[:copy_username]
    json.copy_end_time challenge[:copy_end_time]
    json.code_rate challenge[:code_rate]
    json.code_list challenge[:code_list]
  end
end