实训跳关

dev_auth
cxt 5 years ago
parent 9a530e5dfa
commit 9e4914c132

@ -440,6 +440,7 @@ class HomeworkCommonsController < ApplicationController
@user = current_user
@work = @homework.user_work(current_user.id) if @user_course_identity == Course::STUDENT
@course_groups = @course.course_groups.where(id: @course.charge_group_ids(@user))
@shixun = @homework.shixuns.take if @homework.homework_type == "practice"
end
def update_settings

@ -46,7 +46,16 @@ class Challenge < ApplicationRecord
#self.challenge_chooses.pluck(:score).sum
end
# 关卡总分
def challenge_difficulty
case difficulty
when 1 then "简单"
when 2 then "中等"
when 3 then "困难"
else ''
end
end
# 关卡总分
def all_score
self.score
# if self.st == 1

@ -15,17 +15,19 @@ json.group_settings @course_groups do |group|
end
if @homework.homework_type == "practice"
json.shixun_identifier @homework.shixuns.first.try(:identifier)
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 @homework.shixuns.first.try(:challenges).each do |challenge|
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

Loading…
Cancel
Save