From d9c76bf38184a8f7a19ab69151f00c0787f2fc4f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 16 May 2019 10:07:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=89=B9=E9=87=8F=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 6 +++--- app/views/exercise/student_exercise_list.js.erb | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 2f01c494..68a121c6 100755 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -54,10 +54,10 @@ class ZipdownController < ApplicationController else student_in_group = '(' + group_students.map{ |member| member.user_id }.join(',') + ')' end - exercise_users_list = exercise.exercise_users.where("user_id in #{student_in_group}").order("#{order} #{b_sort}") + exercise_users_list = exercise.exercise_users.where("user_id in #{student_in_group} and commit_status = 1").order("#{order} #{b_sort}") else - exercise_users_list = exercise.exercise_users.where("user_id in #{student_id}").order("#{order} #{b_sort}") + exercise_users_list = exercise.exercise_users.where("user_id in #{student_id} and commit_status = 1").order("#{order} #{b_sort}") end unless comment.blank? @@ -77,7 +77,7 @@ class ZipdownController < ApplicationController exercise_users_list = exercise_users_list.select{ |exercise| exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name)} end - zipfile = zip_user_exercise exercise, exercise_users_list.select{|exercise| exercise.commit_status = 1} + zipfile = zip_user_exercise exercise, exercise_users_list file = decode64(zipfile[0][:base64file]) send_file "#{OUTPUT_FOLDER}/#{file}", :filename => filename_for_content_disposition(file), :type => detect_content_type(file) diff --git a/app/views/exercise/student_exercise_list.js.erb b/app/views/exercise/student_exercise_list.js.erb index 864adb99..abc6b137 100755 --- a/app/views/exercise/student_exercise_list.js.erb +++ b/app/views/exercise/student_exercise_list.js.erb @@ -1,2 +1,9 @@ $("#exercise_student_work_list").html("<%= escape_javascript(render :partial => 'exercise/student_exercise') %>"); -$("#export_exercise_work").replaceWith("<%= escape_javascript(link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :order => @order, :sort => @b_sort, :name => @name, :ex_group => @group, :ex_comment => @comment, :ex_status => @status, :format => 'xls'), :class => "fr white-btn orange-btn mt10 ml15", :id => "export_exercise_work") %>"); + +$("#export_exercise_work").replaceWith("<%= escape_javascript(link_to "导出成绩", student_exercise_list_exercise_path(@exercise, +:course_id => @course.id, :order => @order, :sort => @b_sort, :name => @name, :ex_group => @group, :ex_comment => @comment, +:ex_status => @status, :format => 'xls'), :class => "fr white-btn orange-btn mt10 ml15", :id => "export_exercise_work") %>"); + +$("#export_exercise_user").replaceWith("<%= escape_javascript(link_to "PDF存档", zipdown_assort_path(:obj_class => @exercise.class, +:obj_id => @exercise.id,:order => @order, :sort => @b_sort, :name => @name, :ex_group => @group, :ex_comment => @comment, +:ex_status => @status), :class => "fl white-btn orange-btn mt10 export_exercise_user_zip", :id => "export_exercise_user") %>");