实训作业列表的接口调整

sso^2
cxt 5 years ago
parent a8ba239929
commit 88eea571bb

@ -26,19 +26,17 @@ json.homeworks @homework_commons.each do |homework|
json.uncommit_count studentwork_count homework, 0, @member json.uncommit_count studentwork_count homework, 0, @member
end end
if @user_course_identity < Course::STUDENT
if homework.homework_type == "practice" if homework.homework_type == "practice"
json.shixun_identifier homework.shixuns.take.try(:identifier) json.shixun_identifier homework.shixuns.take.try(:identifier)
json.shixun_status homework.shixuns.take.try(:status).to_i json.shixun_status homework.shixuns.take.try(:status).to_i
end end
elsif @user_course_identity == Course::STUDENT if @user_course_identity == Course::STUDENT
if homework.homework_type == "practice" if homework.homework_type == "practice"
shixun = homework.shixuns.take shixun = homework.shixuns.take
# json.challenge_count homework.shixuns.first.try(:challenges_count).to_i # json.challenge_count homework.shixuns.first.try(:challenges_count).to_i
current_myshixun = homework.user_work(@user.id).try(:myshixun) current_myshixun = homework.user_work(@user.id).try(:myshixun)
myshixun = current_myshixun ? current_myshixun : shixun.myshixuns.find_by(user_id: @user.id) myshixun = current_myshixun ? current_myshixun : shixun.myshixuns.find_by(user_id: @user.id)
# json.game_count current_myshixun ? current_myshixun.exec_count : 0 # json.game_count current_myshixun ? current_myshixun.exec_count : 0
json.shixun_status shixun.try(:status).to_i
json.task_operation task_operation_url(myshixun, shixun) json.task_operation task_operation_url(myshixun, shixun)
else else
work = homework.user_work(@user.id) work = homework.user_work(@user.id)

Loading…
Cancel
Save