Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-07-20 17:45:11 +08:00
commit 27da12e7f8
15 changed files with 326 additions and 47 deletions

View File

@ -95,7 +95,7 @@ class HomeworkCommonController < ApplicationController
homework_detail_programing = HomeworkDetailPrograming.new homework_detail_programing = HomeworkDetailPrograming.new
homework_detail_programing.language = "C++" homework_detail_programing.language = "C++"
homework_detail_programing.standard_code = params[:standard_code] homework_detail_programing.standard_code = params[:standard_code]
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
question = {title:homework.name,content:homework.description} question = {title:homework.name,content:homework.description}
question[:input] = [] question[:input] = []
question[:output] = [] question[:output] = []
@ -211,6 +211,7 @@ class HomeworkCommonController < ApplicationController
if @homework.homework_type == 2 && @homework_detail_programing #编程作业 if @homework.homework_type == 2 && @homework_detail_programing #编程作业
@homework_detail_programing.language = "C++" @homework_detail_programing.language = "C++"
@homework_detail_programing.standard_code = params[:standard_code] @homework_detail_programing.standard_code = params[:standard_code]
@homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_tests = @homework.homework_tests homework_tests = @homework.homework_tests
#需要删除的测试 #需要删除的测试
ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i)

View File

@ -362,13 +362,33 @@ class ProjectsController < ApplicationController
end end
# dts测试工具 # dts测试工具
def dts_rep def dts_dep
render_403 unless User.current.admin? render_403 unless User.current.admin?
@dts = Dts.all @dts = Dts.all
end end
# dts云部署 # dts云部署
def dts_yun def yun_dep
render_403 unless User.current.admin?
end
# 软件知识库
def soft_knowledge
render_403 unless User.current.admin?
end
# 在线开发平台
def online_dev
render_403 unless User.current.admin?
end
# 软件资源库
def soft_file
render_403 unless User.current.admin?
end
# 软件服务
def soft_service
render_403 unless User.current.admin? render_403 unless User.current.admin?
end end

View File

@ -1,12 +1,12 @@
# encoding: utf-8 # encoding: utf-8
class StudentWorkTest < ActiveRecord::Base class StudentWorkTest < ActiveRecord::Base
attr_accessible :student_work_id, :homework_test_id attr_accessible :student_work_id, :homework_test_id, :result
belongs_to :homework_test belongs_to :homework_test
belongs_to :student_work belongs_to :student_work
def status_to_s def status_to_s
case self.result case self.result.to_i
when -1 when -1
'编译出错' '编译出错'
when -2 when -2
@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base
end end
def test_score def test_score
if self.result == 0 if self.result.to_i == 0
format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count)
else else
0 0

View File

@ -711,19 +711,19 @@ class CoursesService
" limit 0,4" " limit 0,4"
active_students = User.find_by_sql(sql1) active_students = User.find_by_sql(sql1)
if homework_count != 0 && !better_students.empty? if homework_count != 0 && !better_students.empty?
latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 4,:better_students=> better_students} latest_course_dynamics <<{:type=> 6,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:better_students=> better_students}
end end
unless active_students.empty? unless active_students.empty?
latest_course_dynamics <<{:type=> 7,:time=>Time.now.to_s,:count=> 4,:active_students=>active_students} latest_course_dynamics <<{:type=> 7,:time=>"1970-01-01 0:0:0 +0800",:count=> 4,:active_students=>active_students}
end end
latest_course_dynamic = latest_course_dynamics.first latest_course_dynamic = latest_course_dynamics.first
unless latest_course_dynamic.nil? unless latest_course_dynamic.nil?
result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics, result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics,
:course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << ""} :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "",:time=>latest_course_dynamic[:time].to_time}
end end
end end
#返回数组集合 #返回数组集合
result.sort! { |order, newer| newer[:update_time] <=> order[:update_time] } result.sort! { |order, newer| newer[:time] <=> order[:time] }
result result
end end

View File

@ -37,12 +37,37 @@
</li> </li>
<li> <li>
<% if User.current.admin? %> <% if User.current.admin? %>
<%= link_to l(:label_project_dts_new) ,dts_rep_project_path(@project), data: { confirm:'你确定要进行DTS测试吗' } %> <%= link_to l(:label_project_dts_new) ,dts_dep_project_path(@project), data: { confirm:'你确定要进行DTS测试吗' } %>
<% end %> <% end %>
</li> </li>
<li> <li>
<% if User.current.admin? %> <% if User.current.admin? %>
<%= link_to l(:label_project_dts_yun) ,dts_yun_project_path(@project) %> <%= link_to l(:label_project_dts_yun) ,yun_dep_project_path(@project), data: { confirm:'你确定要进行云化部署吗?' } %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://tsr.sei.pku.edu.cn/KnowledgeBaseDC/semantic-search.jsp?projectName=jena
" target="_Blank">软件知识库</a>
<%#= link_to l(:label_project_soft_knowledge) ,soft_knowledge_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://tsr.sei.pku.edu.cn/home.action" target="_Blank">软件资源库</a>
<%#= link_to l(:label_project_soft_file) ,soft_file_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.seforge.org/pop-php/" target="_Blank">在线开发平台</a>
<%#= link_to l(:label_project_online_dev) ,online_dev_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.seforge.org/sase/" target="_Blank">软工服务平台</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %> <% end %>
</li> </li>
<!--<li>--> <!--<li>-->

View File

@ -9,47 +9,42 @@
#font_color{background:yellow;text-align:center;color:white;} #font_color{background:yellow;text-align:center;color:white;}
</style> </style>
<div style="padding-left: 200px;"> <div style="padding-left: 200px;">
<div id='out'> <div id='out'>
<p style="padding-left: 120px;padding-bottom: 10px;font-size: 14px;">测试分析中</p> <p style="padding-left: 110px;padding-bottom: 10px;font-size: 14px;">测试分析中...</p>
<div style="width:300px;height:20px;background:#EEE;"> <div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div> <div id="in" style="width:1%">0%</div>
<div> <div>
<script type="text/javascript"> <script type="text/javascript">
i=0; i=0;
$(function(){ $(function(){
ba=setInterval("begin()",50);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数 ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
}); });
function begin() function begin()
{
i+=1;
if(i<=100)
{ {
document.getElementById("in").style.width=i+"%"; i+=1;
document.getElementById("in").innerHTML=i+"%";} if(i<=100)
else {
{ document.getElementById("in").style.width=i+"%";
clearInterval(ba); document.getElementById("in").innerHTML=i+"%";}
$("#show_content_div").show(); else
$("#out").hide(); {
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none"; // document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>"); // document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
} }
}
</script> </script>
</div>
</div>
</div> </div>
</div>
</div>
</div> </div>
<div id="show_content_div" style="display: none;padding-top: 0px;"> <div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="fr f14 ">语言:<span style="color: red">Java</span> 总文件数:<span style="color: red">361</span> 代码行数:<span style="color: red">48662</span></p> <p class="fr f14 ">语言:<span style="color: red">Java</span> 总文件数:<span style="color: red">361</span> 代码行数:<span style="color: red">48662</span></p>
<!--<p class="box_h3" style="text-align:center; padding-top: 20px; ">具体测试结果</p>-->
<!--<div style="font-size: 14px;">-->
<!--<p class="">描叙:</p>-->
<!--<p style="padding-left: 10px;color:#ACAEB1 "><%#= @dts.Description %></p>-->
<!--</div>-->
<% @dts.each do |dt| %> <% @dts.each do |dt| %>
<table width="600" border="2" bordercolor="red" style="padding-top: 10px; padding-left: 30px;"> <table width="600" border="2" bordercolor="red" style="padding-top: 10px; padding-left: 30px;">
<tr> <tr>

View File

@ -1,3 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_yun) %></h2>
</div>

View File

@ -0,0 +1,47 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_online_dev) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 100px;padding-bottom: 10px;font-size: 14px;">在线开发部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",40);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px; ">
<p class="pl10 f14 "><span style="color: #7f7f7f;font-size: 14px; ">点击进入:</span>
<span><a href="http://rubyblog.forge.trustie.net/myblog" target="_Blank" style="color: #15BCCF;font-size: 14px;">在线开发平台</a></span></p>
</div>

View File

@ -0,0 +1,46 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_soft_file) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 100px;padding-bottom: 10px;font-size: 14px;">软件资源库部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="pl10 f14 "><a href="http://rubyblog.forge.trustie.net/myblog">云化部署工具部署完后的网址</a></p>
</div>

View File

@ -0,0 +1,46 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_soft_knowledge) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 120px;padding-bottom: 10px;font-size: 14px;">云化部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="pl10 f14 "><a href="http://rubyblog.forge.trustie.net/myblog">云化部署工具部署完后的网址</a></p>
</div>

View File

@ -0,0 +1,46 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_soft_service) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 120px;padding-bottom: 10px;font-size: 14px;">云化部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",30);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px;">
<p class="pl10 f14 "><a href="http://rubyblog.forge.trustie.net/myblog">云化部署工具部署完后的网址</a></p>
</div>

View File

@ -0,0 +1,47 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_yun) %></h2>
</div>
<!--JS进度条-->
<style type="text/css">
#out{}
#in{width:10px; height:20px;background:#15BCCF;color:white;text-align:center;}
#font_color{background:yellow;text-align:center;color:white;}
</style>
<div style="padding-left: 200px;">
<div id='out'>
<p style="padding-left: 120px;padding-bottom: 10px;font-size: 14px;">云化部署中...</p>
<div style="width:300px;height:20px;background:#EEE;">
<div id="in" style="width:1%">0%</div>
<div>
<script type="text/javascript">
i=0;
$(function(){
ba=setInterval("begin()",10);//setInterval 返回的是一个全局变量,一个间隔数值.这个数值是表示调用setInterval的次数
});
function begin()
{
i+=1;
if(i<=100)
{
document.getElementById("in").style.width=i+"%";
document.getElementById("in").innerHTML=i+"%";}
else
{
clearInterval(ba);
$("#show_content_div").show();
$("#out").hide();
// document.getElementById("out").style.display="none";
// document.write("<span style='background:yellow;text-align:center;color:white;'>Successs!</span>");
}
}
</script>
</div>
</div>
</div>
</div>
<div id="show_content_div" style="display: none;padding-top: 0px; ">
<p class="pl10 f14 "><span style="color: #7f7f7f;font-size: 14px; ">点击进入:</span>
<span><a href="http://rubyblog.forge.trustie.net/myblog" target="_Blank" style="color: #15BCCF;font-size: 14px;">云化部署平台</a></span></p>
</div>

View File

@ -49,6 +49,7 @@
</td> </td>
<td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td> <td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td>
<td class="td_50 "><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%></td> <td class="td_50 "><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%></td>
<input type="hidden" value="<%= test.student_work_test.result if test.student_work_test%>">
</tr> </tr>
<% end%> <% end%>

View File

@ -93,6 +93,10 @@ zh:
label_project_dts_new: DTS测试 label_project_dts_new: DTS测试
label_project_dts_statics: DTS缺陷报告 label_project_dts_statics: DTS缺陷报告
label_project_dts_yun: 云化部署 label_project_dts_yun: 云化部署
label_project_soft_knowledge: 软件知识库
label_project_soft_file: 软件资源库
label_project_online_dev: 在线开发平台
label_project_soft_service: 软工服务平台
label_project_overview: "项目简介" label_project_overview: "项目简介"
label_expend_information: 展开更多信息 label_expend_information: 展开更多信息

View File

@ -387,8 +387,12 @@ RedmineApp::Application.routes.draw do
get 'watcherlist', :action=> 'watcherlist' get 'watcherlist', :action=> 'watcherlist'
# 添加dts测试工具 # 添加dts测试工具
get 'dts_rep', :action=> 'dts_rep' get 'dts_dep', :action=> 'dts_dep'
get 'dts_yun', :action=> 'dts_yun' get 'yun_dep', :action=> 'yun_dep'
get 'soft_knowledge', :action=> 'soft_knowledge'
get 'soft_file', :action=> 'soft_file'
get 'online_dev', :action=> 'online_dev'
get 'soft_service', :action=> 'soft_service'
get 'invite_members', :action=> 'invite_members' get 'invite_members', :action=> 'invite_members'
get 'invite_members_by_mail', :action=> 'invite_members_by_mail' get 'invite_members_by_mail', :action=> 'invite_members_by_mail'