json.partial! "homework_public_navigation", locals: {homework: @homework, course: @course, user: @user}

json.partial! "homework_btn_check", locals: {identity: @user_course_identity, homework: @homework, user: @user}

json.partial! "student_btn_check", locals: {identity: @user_course_identity, homework: @homework, work: @work}

json.(@homework, :unified_setting, :publish_time, :end_time, :late_penalty, :allow_late, :late_time, :work_public,
    :score_open, :answer_public, :total_score)

json.group_settings @course_groups do |group|
  json.group_id group.id
  json.group_name group.name
  json.publish_time group_homework_setting(@homework, group.id).try(:publish_time)
  json.end_time group_homework_setting(@homework, group.id).try(:end_time)
end

if @homework.homework_type == "practice"
  json.shixun_identifier @shixun.try(:identifier)
  json.task_pass @shixun&.task_pass
  json.(@homework, :work_efficiency, :eff_score)
  json.(@homework.homework_detail_manual, :answer_open_evaluation, :shixun_evaluation)

  total_exp = 0
  json.challenge_settings @shixun.try(:challenges).each do |challenge|
    json.challenge_id challenge.id
    json.challenge_name challenge.subject
    json.checked challenge_setting(@homework, challenge.id).present?
    json.challenge_score challenge_setting(@homework, challenge.id).try(:score).to_f
    json.challenge_exp challenge.score
    json.difficulty challenge.challenge_difficulty
    total_exp += challenge.score
  end

  json.shixun_exp total_exp

elsif @homework.homework_type == "normal" || @homework.homework_type == "group"
  json.(@homework, :anonymous_comment, :anonymous_appeal)
  json.(@homework.homework_detail_manual, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty,
      :appeal_time, :appeal_penalty, :ta_mode, :final_mode, :te_proportion, :ta_proportion)

  json.st_proportion homework_st_proportion(@homework)
end
