From 43363e8bcb89021e5e7ad5eaa2de8e596d3c3813 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 18 Jun 2015 17:56:28 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 11 +++-
app/helpers/student_work_helper.rb | 10 ++++
app/views/student_work/index.html.erb | 2 +-
.../student_work_absence_penalty.html.erb | 54 +++++++++++++++++++
config/routes.rb | 1 +
public/stylesheets/courses.css | 6 ++-
public/stylesheets/public.css | 1 +
7 files changed, 82 insertions(+), 3 deletions(-)
create mode 100644 app/views/student_work/student_work_absence_penalty.html.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 30fd0ff50..3dd5e9890 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -2,7 +2,7 @@ class StudentWorkController < ApplicationController
layout "base_courses"
include StudentWorkHelper
require 'bigdecimal'
- before_filter :find_homework, :only => [:new, :index, :create]
+ before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
@@ -233,6 +233,15 @@ class StudentWorkController < ApplicationController
end
end
+ #评价列表显示
+ def student_work_absence_penalty
+ render_403 unless User.current.allowed_to?(:as_teacher,@course)
+ @stundet_works = @homework.student_works
+ respond_to do |format|
+ format.html
+ end
+ end
+
private
#获取作业
def find_homework
diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb
index 990a563c4..7c85dc5c4 100644
--- a/app/helpers/student_work_helper.rb
+++ b/app/helpers/student_work_helper.rb
@@ -60,4 +60,14 @@ module StudentWorkHelper
def is_praise_homework user_id, obj_id
PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").empty?
end
+
+ #获取指定学生在指定作业内应匿评的数量
+ def all_evaluation_count user,homework
+ StudentWorksEvaluationDistribution.joins(:student_work).where("student_works_evaluation_distributions.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count
+ end
+
+ #获取指定学生在指定作业内已匿评的数量
+ def has_evaluation_count user,homework
+ StudentWorksScore.joins(:student_work).where("student_works_scores.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count
+ end
end
\ No newline at end of file
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index c9e8cd4c6..09d1c8f60 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -18,7 +18,6 @@
返
回
顶
部
-
@@ -37,6 +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"%>
<% end%>
<% if @is_teacher%>
diff --git a/app/views/student_work/student_work_absence_penalty.html.erb b/app/views/student_work/student_work_absence_penalty.html.erb
new file mode 100644
index 000000000..a0d6cdc04
--- /dev/null
+++ b/app/views/student_work/student_work_absence_penalty.html.erb
@@ -0,0 +1,54 @@
+
+
+ 缺评情况
+
+
+
+
+
+
+
+
+ <% @stundet_works.each do |student_work|%>
+
" id="student_work_<%= student_work.id%>">
+ -
+
+ <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
+
+
+ -
+ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
+
+ <%
+ all_count = all_evaluation_count student_work.user,@homework
+ has_count = has_evaluation_count student_work.user,@homework
+ absence = all_count - has_count
+ %>
+ -
+ <%= all_count%>
+
+ -
+ <%= has_count%>
+
+ -
+ <%= absence%>
+
+
+ <% end%>
+
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index c92c732d2..b5a244345 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -97,6 +97,7 @@ RedmineApp::Application.routes.draw do
collection do
post 'add_score_reply'
get 'destroy_score_reply'
+ get 'student_work_absence_penalty'
end
end
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index f4e72019f..b2e68085a 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -635,6 +635,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.mr18{ margin-right:18px;}
a.hwork_center{ display:block; width:60px; margin-right:5px;overflow: hidden; white-space: nowrap; text-overflow:ellipsis;}
.hwork_name{ display:block;width:80px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.absence_penalty{ display:block;width:45px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.border_ce {border: 1px solid #e4e4e4;}
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
.show_hwork ul li{ margin-bottom:5px;}
.show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;}
@@ -657,7 +659,9 @@ a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;}
/*返回顶部*/
.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}
-
+.hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.hwork_name_ab{ display:block;width:340px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
+.absence{width: 50px;text-align: center;}
/* 评分插件 */
input#score{ width:40px;}
.ui-slider{position:relative;width:200px;float:left;margin-right:10px;height:14px; margin-top:2px;background:#e2e2e2; }
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 0ed497127..cdcde2559 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -69,6 +69,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml90{ margin-left:90px;}
.ml100{ margin-left:100px;}
.ml110{ margin-left:110px;}
+.ml320{ margin-left:320px;}
.mr5{ margin-right:5px;}
.mr10{ margin-right:10px;}
.mr20{ margin-right:20px;}