dev_course
cxt 5 years ago
parent a83b4f1327
commit 177dded969

@ -25,14 +25,16 @@ json.homeworks @homework_commons.each do |homework|
if @user_course_identity < Course::STUDENT if @user_course_identity < Course::STUDENT
if homework.homework_type == "practice" if homework.homework_type == "practice"
json.shixun_identifier homework.shixuns.first.try(:identifier) json.shixun_identifier homework.shixuns.take.try(:identifier)
end end
elsif @user_course_identity == Course::STUDENT elsif @user_course_identity == Course::STUDENT
if homework.homework_type == "practice" if homework.homework_type == "practice"
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)
# json.game_count current_myshixun ? current_myshixun.exec_count : 0 # json.game_count current_myshixun ? current_myshixun.exec_count : 0
json.task_operation task_operation_url(current_myshixun, homework.shixuns.first) json.task_operation task_operation_url(current_myshixun, shixun)
else else
work = homework.user_work(@user.id) work = homework.user_work(@user.id)
json.work_id work.try(:id) json.work_id work.try(:id)

Loading…
Cancel
Save