Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework
This commit is contained in:
commit
bb642d320d
|
@ -268,11 +268,9 @@ class HomeworkAttachController < ApplicationController
|
|||
def show
|
||||
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
|
||||
# 打分统计
|
||||
stars_reates = @homework.
|
||||
rates(:quality)
|
||||
stars_reates = @homework. rates(:quality)
|
||||
stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
|
||||
stars_status = stars_reates.select("stars, count(*) as scount").
|
||||
group("stars")
|
||||
stars_status = stars_reates.select("stars, count(*) as scount").group("stars")
|
||||
@stars_status_map = Hash.new(0.0)
|
||||
stars_status.each do |star_status|
|
||||
percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f
|
||||
|
@ -294,6 +292,10 @@ class HomeworkAttachController < ApplicationController
|
|||
|
||||
@totle_score = score_for_homework @homework
|
||||
@teaher_score = teacher_score_for_homework @homework
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
|
|
|
@ -394,10 +394,7 @@ module CoursesHelper
|
|||
#获取作业的教师评分
|
||||
#多个教师只获取一份教师评分
|
||||
def teacher_score_for_homework homework
|
||||
members = searchTeacherAndAssistant(homework.bid.courses.first)#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
|
||||
#if member.nil?
|
||||
# return "0.00"
|
||||
#end
|
||||
members = searchTeacherAndAssistant(homework.bid.courses.first)
|
||||
teacher_ids = []
|
||||
members.each do |user|
|
||||
teacher_ids << user.user_id
|
||||
|
@ -407,7 +404,7 @@ module CoursesHelper
|
|||
teacher_stars.each do |star|
|
||||
teacher_stars_count = teacher_stars_count + star.stars
|
||||
end
|
||||
return format("%.2f",teacher_stars_count)
|
||||
return format("%.2f",teacher_stars.count > 0 ? teacher_stars_count/teacher_stars.count : 0)
|
||||
end
|
||||
|
||||
#获取指定项目的得分
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
</div><!---未批作业结束-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="show_homework_attach_model"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<% else %>
|
||||
<% homework_filename = homework.name %>
|
||||
<% end %>
|
||||
<%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename%>
|
||||
<%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename, :remote => true%>
|
||||
</li>
|
||||
<li class="wdown">
|
||||
<%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
|
||||
|
@ -52,9 +52,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<li class="wping">
|
||||
<a href="#" target="_blank">
|
||||
<%= l(:label_work_rating)%>
|
||||
</a>
|
||||
<%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %>
|
||||
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red"> 迟交!</span>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>作业评分弹框</title>
|
||||
<script type="text/javascript" language="javascript">
|
||||
//<!CDATA[
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=6;i<=7;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
|
||||
}
|
||||
</script>
|
||||
<%= stylesheet_link_tag 'css', :media => 'all' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="popbox">
|
||||
<div class="alert" style="position: fixed;">
|
||||
<div>
|
||||
|
||||
<span class="close" style="display: block;" onclick="hideModal(this)"></span>
|
||||
</div>
|
||||
</div> <!---- alert end---->
|
||||
<div class="ping_con">
|
||||
<h2>科大校园助手最终提交文档及源码</h2>
|
||||
<ul>
|
||||
<li>参与人员:<span class="c_grey">gugu02</span></li>
|
||||
<li style=" margin-left:130px;">发布时间:<span class="c_grey" >2014-10-24</span></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<p>我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者你不了解java基础。测试结果只代表算法效率,测一个号码是因为正确号码运算次数基本相同,如果你们用自己的电脑测,13亿次循环应该不到1分钟。这种设计思路,也可以套式信息验证上去。</p>
|
||||
<p style=" border-bottom:none; color:#333; margin-top:8px;" ><strong>附件:</strong><span><a href="#">附件1</a>,<a href="#">附件2</a>,<a href="#">附件3</a>,<a href="#">附件4</a>,<a href="#">附件5</a>,</span></p>
|
||||
|
||||
<div class="ping_star">
|
||||
评分:
|
||||
<span class="star01"><a href="#"></a></span>
|
||||
<span class="star02"><a href="#"></a></span>
|
||||
<span class="star03"><a href="#"></a></span>
|
||||
<span class="star04"><a href="#"></a></span>
|
||||
<span class="star05"><a href="#"></a></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<textarea id="ta_msg_content" name="content" placeholder="最多250个字" ></textarea>
|
||||
<a href="#" class="ping_sub">提交评论</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="ping_list">
|
||||
<div id="ping_tb_" class="ping_tb_">
|
||||
<ul>
|
||||
<li id="ping_tb_6" class="ping_hovertab" onmouseover="x:HoverLi(6);">
|
||||
全部评论(100)</li>
|
||||
<li id="ping_tb_7" class="ping_normaltab" onmouseover="i:HoverLi(7);">
|
||||
教师评论</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ping_ctt">
|
||||
<div class="ping_dis" id="tbc_06">
|
||||
<div class="ping_C">
|
||||
<div class="ping_dispic"><a href="#" target="_blank"><img src="images/225905790.jpg" width="46" height="46" /></a></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop">
|
||||
<span><a href="#" target="_blank" style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" >gugu01</a></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;" >2014-10-24</span><span style="font-weight:bold; color:#a6a6a6; " >评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
|
||||
<div class="cl"></div>
|
||||
<p>我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者</p>
|
||||
</div>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ping_C">
|
||||
<div class="ping_dispic"><a href="#" target="_blank"><img src="images/225905790.jpg" width="46" height="46" /></a></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop">
|
||||
<span><a href="#" target="_blank" style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" >gugu01</a></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;" >2014-10-24</span><span style="font-weight:bold; color:#a6a6a6; " >评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
|
||||
<div class="cl"></div>
|
||||
<p>我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者</p>
|
||||
</div>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ping_C">
|
||||
<div class="ping_dispic"><a href="#" target="_blank"><img src="images/225905790.jpg" width="46" height="46" /></a></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop">
|
||||
<span><a href="#" target="_blank" style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" >gugu01</a></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;" >2014-10-24</span><span style="font-weight:bold; color:#a6a6a6; " >评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
|
||||
<div class="cl"></div>
|
||||
<p>我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者</p>
|
||||
</div>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div><!--全部评论end-->
|
||||
|
||||
<div class="ping_undis" id="tbc_07">
|
||||
<div class="ping_C">
|
||||
<div class="ping_dispic"><a href="#" target="_blank"><img src="images/225905790.jpg" width="46" height="46" /></a></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop">
|
||||
<span><a href="#" target="_blank" style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" >gugu01</a></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;" >2014-10-24</span><span style="font-weight:bold; color:#a6a6a6; " >评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
|
||||
<div class="cl"></div>
|
||||
<p>我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,多了,或者</p>
|
||||
</div>
|
||||
<div class="ping_disfoot"><a href="#">删除</a><a href="#">回复</a></div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div><!---ping_list end--->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>');
|
||||
showModal('ajax-modal', '510px');
|
||||
$('#ajax-modal').css('height','500px');
|
|
@ -60,7 +60,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
|||
|
||||
|
||||
/****评分弹框****/
|
||||
#popbox{width:488px;height:550px;position:absolute;z-index:100;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }
|
||||
|
||||
.alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(images/close.png) no-repeat;cursor:pointer;}
|
||||
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue