dev_forum
cxt 5 years ago
parent 3a028a6679
commit 7a9a78d918

@ -1169,7 +1169,7 @@ class CoursesController < ApplicationController
#实训作业
if shixun_homeworks.count > 0
shixun_homeworks.each do |s|
user_student_work = s.score_student_works.find_by_user_id(user.id) #当前用户的对该作业的回答
user_student_work = s.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work.nil?
h_score = 0.0 #该作业的得分为0
else
@ -1185,7 +1185,7 @@ class CoursesController < ApplicationController
#普通作业
if common_homeworks.count > 0
common_homeworks.each do |c|
user_student_work_1 = c.score_student_works.find_by_user_id(user.id) #当前用户的对该作业的回答
user_student_work_1 = c.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work_1.nil?
h_score_1 = 0.0 #该作业的得分为0
else
@ -1201,7 +1201,7 @@ class CoursesController < ApplicationController
#分组作业
if group_homeworks.count > 0
group_homeworks.each do |g|
user_student_work_3 = g.score_student_works.find_by_user_id(user.id) #当前用户的对该作业的回答
user_student_work_3 = g.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work_3.nil?
h_score_3 = 0.0 #该作业的得分为0
else
@ -1217,7 +1217,7 @@ class CoursesController < ApplicationController
#毕设作业
if tasks.count > 0
tasks.each do |task|
graduation_work = task.score_graduation_works.find_by_user_id(user.id)
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
if graduation_work.nil?
t_score = 0.0
else
@ -1233,7 +1233,7 @@ class CoursesController < ApplicationController
#试卷
if exercises.count > 0
exercises.each do |ex|
exercise_work = ex.score_exercise_users.find_by_user_id(user.id)
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
if exercise_work.nil?
e_score = 0.0
else

Loading…
Cancel
Save