|
|
@ -1190,9 +1190,9 @@ class CoursesController < ApplicationController
|
|
|
|
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
|
|
|
|
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
@homeworks = @course.homework_commons.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("publish_time asc")
|
|
|
|
@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("publish_time asc")
|
|
|
|
@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|
|
|
|
|
respond_to do |format|
|
|
|
|
format.xls {
|
|
|
|
format.xls {
|
|
|
@ -2425,7 +2425,7 @@ class CoursesController < ApplicationController
|
|
|
|
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
|
|
|
|
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
|
|
|
|
# current_col = 5
|
|
|
|
# current_col = 5
|
|
|
|
shixun_score = 0
|
|
|
|
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}")
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
if student_works.empty?
|
|
|
|
if student_works.empty?
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
@ -2437,7 +2437,7 @@ class CoursesController < ApplicationController
|
|
|
|
# current_col += 1
|
|
|
|
# current_col += 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
common_score = 0
|
|
|
|
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}")
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
if student_works.empty?
|
|
|
|
if student_works.empty?
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
@ -2449,7 +2449,7 @@ class CoursesController < ApplicationController
|
|
|
|
# current_col += 1
|
|
|
|
# current_col += 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
group_score = 0
|
|
|
|
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}")
|
|
|
|
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
|
|
|
if student_works.empty?
|
|
|
|
if student_works.empty?
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
@ -2461,7 +2461,7 @@ class CoursesController < ApplicationController
|
|
|
|
# current_col += 1
|
|
|
|
# current_col += 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
exercise_score = 0
|
|
|
|
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}")
|
|
|
|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
|
|
|
|
if exercise_user.empty?
|
|
|
|
if exercise_user.empty?
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
@ -2474,7 +2474,7 @@ class CoursesController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
graduation_score = 0
|
|
|
|
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}")
|
|
|
|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
|
|
|
|
if graduation_works.empty?
|
|
|
|
if graduation_works.empty?
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
|
sheet1[count_row,column+=1] = 0
|
|
|
@ -2550,7 +2550,7 @@ class CoursesController < ApplicationController
|
|
|
|
count_row += 1
|
|
|
|
count_row += 1
|
|
|
|
end
|
|
|
|
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 = book.create_worksheet :name => "实训作业第#{i+1}次"
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
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)])
|
|
|
|
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
|
|
|
|
count_row = 5
|
|
|
|
items = home.student_works.where("work_status != 0").order("work_score desc")
|
|
|
|
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|
|
|
|
|
items.each_with_index do |stu, j|
|
|
|
|
sheet[count_row,0]= j + 1
|
|
|
|
sheet[count_row,0]= j + 1
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
|
sheet[count_row,1] = stu.user.show_real_name
|
|
|
@ -2580,7 +2584,7 @@ class CoursesController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
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 = book.create_worksheet :name => "普通作业第#{i+1}次"
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
sheet[0,1] = course.id
|
|
|
@ -2627,7 +2631,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
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 = book.create_worksheet :name => "分组作业第#{i+1}次"
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
sheet[0,0] = "课程编号"
|
|
|
|
sheet[0,1] = course.id
|
|
|
|
sheet[0,1] = course.id
|
|
|
|