Merge branch 'dev_aliyun' into educoder

dev_aliyun
daiao 5 years ago
commit 19d2b373d0

@ -12,7 +12,7 @@ class CompetitionTeam < ActiveRecord::Base
def teacher def teacher
teacher_id = self.teachers.first&.user_id teacher_id = self.teachers.first&.user_id
User.find_by(id: teacher_id) User.where(id: teacher_id).first
end end
def group_members def group_members

@ -15,6 +15,7 @@ class CourseMember < ActiveRecord::Base
homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_type in (1, 3, 4)") homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_type in (1, 3, 4)")
if homeworks.count != 0 if homeworks.count != 0
homeworks.each do |hw| homeworks.each do |hw|
next if hw.student_works.where(user_id: user_id).any?
str += "," if str != "" str += "," if str != ""
str += "('#{hw.name}的作品提交',#{hw.id},#{user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" str += "('#{hw.name}的作品提交',#{hw.id},#{user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end end
@ -34,6 +35,7 @@ class CourseMember < ActiveRecord::Base
exercises = course.exercises exercises = course.exercises
if exercises.count != 0 if exercises.count != 0
exercises.each do |ex| exercises.each do |ex|
next if ex.exercise_users.where(user_id: user_id).any?
str += "," if str != "" str += "," if str != ""
str += "(#{ex.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" str += "(#{ex.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end end
@ -53,6 +55,7 @@ class CourseMember < ActiveRecord::Base
polls = course.polls polls = course.polls
if polls.count != 0 if polls.count != 0
polls.each do |poll| polls.each do |poll|
next if poll.poll_users.where(user_id: user_id).any?
str += "," if str != "" str += "," if str != ""
str += "(#{poll.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" str += "(#{poll.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end end
@ -72,6 +75,7 @@ class CourseMember < ActiveRecord::Base
tasks = course.graduation_tasks tasks = course.graduation_tasks
if tasks.count != 0 if tasks.count != 0
tasks.each do |task| tasks.each do |task|
next if task.graduation_works.where(user_id: user_id).any?
str += "," if str != "" str += "," if str != ""
str += "(#{task.id}, #{user_id}, #{course.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" str += "(#{task.id}, #{user_id}, #{course.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
end end

Loading…
Cancel
Save