From 5d9c730fd14a3e9614025c943f86220af2c678c2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 16:17:29 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BD=9C=E4=B8=9A=E4=B8=8D=E7=8E=B0=E5=AE=9E=E7=BC=BA?= =?UTF-8?q?=E8=AF=84=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 6325abc09..0c5983a36 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,7 +36,7 @@ <% if @show_all%> 搜索 - <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher%> + <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1%> <% end%> <% if @is_teacher%>
From 95ab6dd6c0bcd276c823aa57d42069e22571a40b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 16:20:18 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BD=9C=E4=B8=9A=E4=B8=8D=E5=8F=AF=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 0c5983a36..38fcb78c9 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,7 +36,7 @@ <% if @show_all%> 搜索 - <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1%> + <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1 %> <% end%> <% if @is_teacher%>
From a9ff9f96bdf3fee15afd7fa376fd85b3c3046a27 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 16:23:28 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E7=BC=BA=E8=AF=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 3ca836773..2693eea82 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -245,15 +245,19 @@ class StudentWorkController < ApplicationController def student_work_absence_penalty render_403 unless User.current.allowed_to?(:as_teacher,@course) order = params[:order] || "desc" - work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" - @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM( + if @homework.student_works.empty? + @stundet_works = [] + else + work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" + @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM( SELECT * , (SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count, (SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count FROM `student_works` WHERE homework_common_id = #{@homework.id} - ) AS table_1 - ORDER BY absence #{order}") + ) AS table_1 + ORDER BY absence #{order}") + end @order = order == "desc" ? "asc" : "desc" respond_to do |format| format.html From 81187dea363380051cb1a58b5803eb34e683b356 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 24 Jun 2015 16:07:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=9C=89=E5=B8=A6+=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=A0=E6=B3=95=E6=89=93=E5=8C=85=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c514e8940..b90011a4f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -880,7 +880,8 @@ $(function(){ } if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + var file = encodeURI(res[0].file).replace(/\+/g, '%2B'); + location.href = '/zipdown/download?file='+file;return; } document.getElementById('light').style.display='block'; From 251c08e431c2cb96bc6ae71adf88fa1e9e7cec62 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 24 Jun 2015 16:15:44 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=90=8D=E5=B8=A6+=E5=8F=B7=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b90011a4f..aca077d91 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -911,8 +911,10 @@ $(function(){ else { if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + var file = encodeURI(res[0].file).replace(/\+/g, '%2B'); + location.href = '/zipdown/download?file='+file;return; } + document.getElementById('light').style.display='block'; $container = $('#light .upload_box_ul'); $container.empty(); From 38b97aa55877a351bc23b375b5175d061ed6d837 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 24 Jun 2015 16:23:15 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=B8=8B=E8=BD=BDurl=E6=9C=89=E4=B8=A4?= =?UTF-8?q?=E5=A4=84=E9=9C=80=E8=A6=81=E5=A4=84=E7=90=86=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b90011a4f..ce5a960cf 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -863,6 +863,10 @@ function redo() { window.location.reload() } +function encodeHomeworkUrl(url){ + var file = encodeURI(url).replace(/\+/g, '%2B'); + return '/zipdown/download?file='+file; +} //// 作业附件删除 $(function(){ @@ -880,8 +884,7 @@ $(function(){ } if(res.length==1){ - var file = encodeURI(res[0].file).replace(/\+/g, '%2B'); - location.href = '/zipdown/download?file='+file;return; + location.href = encodeHomeworkUrl(res[0].file);return; } document.getElementById('light').style.display='block'; @@ -894,7 +897,7 @@ $(function(){ } else { des = '第'+res[i].index+'个学生的作品下载'; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); } } @@ -911,7 +914,7 @@ $(function(){ else { if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + location.href = encodeHomeworkUrl(res[0].file);return; } document.getElementById('light').style.display='block'; $container = $('#light .upload_box_ul'); @@ -923,7 +926,7 @@ $(function(){ } else { des = '第'+res[i].index+'个学生的作品下载'; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); } }