|
|
|
@ -1190,9 +1190,9 @@ class CoursesController < ApplicationController
|
|
|
|
|
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time asc")
|
|
|
|
|
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc")
|
|
|
|
|
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc")
|
|
|
|
|
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC")
|
|
|
|
|
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC")
|
|
|
|
|
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("IF(ISNULL(publish_time),0,1), publish_time DESC, created_at DESC")
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.xls {
|
|
|
|
@ -2425,7 +2425,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
|
|
|
|
|
# current_col = 5
|
|
|
|
|
shixun_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 4).each do |homework|
|
|
|
|
|
homeworks.where(:homework_type => 4).includes(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
@ -2437,7 +2437,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
common_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 1).each do |homework|
|
|
|
|
|
homeworks.where(:homework_type => 1).includes(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
@ -2449,7 +2449,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
group_score = 0
|
|
|
|
|
homeworks.where(:homework_type => 3).each do |homework|
|
|
|
|
|
homeworks.where(:homework_type => 3).includes(:student_works).each do |homework|
|
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if student_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
@ -2461,7 +2461,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
# current_col += 1
|
|
|
|
|
end
|
|
|
|
|
exercise_score = 0
|
|
|
|
|
exercises.each do |exercise|
|
|
|
|
|
exercises.includes(:exercise_users).each do |exercise|
|
|
|
|
|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
|
|
|
|
|
if exercise_user.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
@ -2474,7 +2474,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
graduation_score = 0
|
|
|
|
|
tasks.each do |task|
|
|
|
|
|
tasks.includes(:graduation_works).each do |task|
|
|
|
|
|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
|
|
|
|
|
if graduation_works.empty?
|
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
@ -2550,7 +2550,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 4).each_with_index do |home, i|
|
|
|
|
|
homeworks.where(:homework_type => 4).includes(:student_works).each_with_index do |home, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "实训作业第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
@ -2567,6 +2567,10 @@ class CoursesController < ApplicationController
|
|
|
|
|
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
|
|
|
|
|
count_row = 5
|
|
|
|
|
items = home.student_works.where("work_status != 0").order("work_score desc")
|
|
|
|
|
if items.count == 0 && home.publish_time < Time.now && !course.is_end
|
|
|
|
|
update_shixun_work_status home
|
|
|
|
|
items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
|
|
|
|
|
end
|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
|
sheet[count_row,0]= j + 1
|
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
@ -2580,7 +2584,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 1).each_with_index do |home, i|
|
|
|
|
|
homeworks.where(:homework_type => 1).includes(:student_works).each_with_index do |home, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "普通作业第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
@ -2627,7 +2631,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
homeworks.where(:homework_type => 3).each_with_index do |home, i|
|
|
|
|
|
homeworks.where(:homework_type => 3).includes(:student_works).each_with_index do |home, i|
|
|
|
|
|
sheet = book.create_worksheet :name => "分组作业第#{i+1}次"
|
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
|