diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 2f40f3fc2..29f270a34 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -113,14 +113,14 @@ class HomeworkCommonsController < ApplicationController else if @user_course_identity == Course::STUDENT @work = @homework.user_work(current_user.id) - work = @homework.student_works.find_by(user_id: current_user.id) - # 学生访问列表时计算个人成绩 - myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id) - if work && myshixun - challenge_settings = @homework.homework_challenge_settings - games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) - HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings + if @homework.homework_type == "practice" + myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id) + if @work && myshixun + challenge_settings = @homework.homework_challenge_settings + games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) + HomeworksService.new.update_myshixun_work_score @work, myshixun, games, @homework, challenge_settings + end end # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段