缺评情况功能

This commit is contained in:
sw 2015-06-18 17:56:28 +08:00
parent 8a3a0af20f
commit 43363e8bcb
7 changed files with 82 additions and 3 deletions

View File

@ -2,7 +2,7 @@ class StudentWorkController < ApplicationController
layout "base_courses" layout "base_courses"
include StudentWorkHelper include StudentWorkHelper
require 'bigdecimal' 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 :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 :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :author_of_work, :only => [:edit, :update, :destroy]
@ -233,6 +233,15 @@ class StudentWorkController < ApplicationController
end end
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 private
#获取作业 #获取作业
def find_homework def find_homework

View File

@ -60,4 +60,14 @@ module StudentWorkHelper
def is_praise_homework user_id, obj_id 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? PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").empty?
end 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 end

View File

@ -18,7 +18,6 @@
返<br/>回<br/>顶<br/>部 返<br/>回<br/>顶<br/>部
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div id="contentbox"> <div id="contentbox">
<div id="tb_" class="hwork_tb_"> <div id="tb_" class="hwork_tb_">
<ul> <ul>
@ -37,6 +36,7 @@
<% if @show_all%> <% if @show_all%>
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);"> <input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
<a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a> <a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
<%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank"%>
<% end%> <% end%>
<% if @is_teacher%> <% if @is_teacher%>
<div class="fr"> <div class="fr">

View File

@ -0,0 +1,54 @@
<div class="project_r_h">
<h2 class="project_h2">
缺评情况
</h2>
</div>
<div class="cl"></div>
<div class="st_box">
<ul class="st_box_top">
<li class="ml10" style="padding-right: 15px;">
<a href="javascript:void(0)">学号</a>
</li>
<li class="ml90" style="padding-right: 5px;">
<a href="javascript:void(0)">姓名</a>
</li>
<li class="ml320">
<a href="javascript:void(0)">应评</a>
</li>
<li class="ml30">
<a href="javascript:void(0)">实评</a>
</li>
<li class="ml30">
<a href="javascript:void(0)">缺评</a>
</li>
</ul>
<div class="cl"></div><!--st_box_top end-->
<% @stundet_works.each do |student_work|%>
<ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>">
<li class="hwork_num_ab mr10 ml10">
<span>
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</span>
</li>
<li class=" hwork_name_ab ">
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
</li>
<%
all_count = all_evaluation_count student_work.user,@homework
has_count = has_evaluation_count student_work.user,@homework
absence = all_count - has_count
%>
<li class="absence c_grey">
<%= all_count%>
</li>
<li class="absence c_grey">
<%= has_count%>
</li>
<li class="absence <%= absence == 0 ? 'c_green' : 'c_red'%>">
<%= absence%>
</li>
</ul>
<% end%>
</div>

View File

@ -97,6 +97,7 @@ RedmineApp::Application.routes.draw do
collection do collection do
post 'add_score_reply' post 'add_score_reply'
get 'destroy_score_reply' get 'destroy_score_reply'
get 'student_work_absence_penalty'
end end
end end

View File

@ -635,6 +635,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.mr18{ margin-right:18px;} .mr18{ margin-right:18px;}
a.hwork_center{ display:block; width:60px; margin-right:5px;overflow: hidden; white-space: nowrap; text-overflow:ellipsis;} 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;} .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{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }
.show_hwork ul li{ margin-bottom:5px;} .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;} .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;} .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;} .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;} input#score{ width:40px;}
.ui-slider{position:relative;width:200px;float:left;margin-right:10px;height:14px; margin-top:2px;background:#e2e2e2; } .ui-slider{position:relative;width:200px;float:left;margin-right:10px;height:14px; margin-top:2px;background:#e2e2e2; }

View File

@ -69,6 +69,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml90{ margin-left:90px;} .ml90{ margin-left:90px;}
.ml100{ margin-left:100px;} .ml100{ margin-left:100px;}
.ml110{ margin-left:110px;} .ml110{ margin-left:110px;}
.ml320{ margin-left:320px;}
.mr5{ margin-right:5px;} .mr5{ margin-right:5px;}
.mr10{ margin-right:10px;} .mr10{ margin-right:10px;}
.mr20{ margin-right:20px;} .mr20{ margin-right:20px;}