Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-07-20 16:38:41 +08:00
commit 749a2497b7
12 changed files with 207 additions and 47 deletions

View File

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

View File

@ -362,13 +362,33 @@ class ProjectsController < ApplicationController
end
# dts测试工具
def dts_rep
def dts_dep
render_403 unless User.current.admin?
@dts = Dts.all
end
# 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?
end

View File

@ -1,12 +1,12 @@
# encoding: utf-8
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 :student_work
def status_to_s
case self.result
case self.result.to_i
when -1
'编译出错'
when -2
@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base
end
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)
else
0

View File

@ -711,19 +711,19 @@ class CoursesService
" limit 0,4"
active_students = User.find_by_sql(sql1)
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
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
latest_course_dynamic = latest_course_dynamics.first
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,
: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
#返回数组集合
result.sort! { |order, newer| newer[:update_time] <=> order[:update_time] }
result.sort! { |order, newer| newer[:time] <=> order[:time] }
result
end

View File

@ -37,12 +37,12 @@
</li>
<li>
<% 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 %>
</li>
<li>
<% 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) %>
<% end %>
</li>
<!--<li>-->

View File

@ -0,0 +1,72 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_statics) %></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: 110px;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="fr f14 ">语言:<span style="color: red">Java</span> 总文件数:<span style="color: red">361</span> 代码行数:<span style="color: red">48662</span></p>
<% @dts.each do |dt| %>
<table width="600" border="2" bordercolor="red" style="padding-top: 10px; padding-left: 30px;">
<tr>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>错误变量</strong></td>
<td style="width: 120px"><%= dt.Variable %></td>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>起始行</strong></td>
<td style="width: 120px"><%= dt.StartLine %></td>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>IP行</strong></td>
<td><%= dt.IPLine %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>缺陷代码</strong></td>
<td colspan="5"><%= dt.IPLineCode %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>错误描述</strong></td>
<td colspan="5"><%= dt.Description %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>文件</strong></td>
<td colspan="5"><%= dt.File %></td>
</tr>
</table>
<% end %>
</div>

View File

@ -1,30 +0,0 @@
<div class="project_r_h">
<h2 class="project_h22"><%= l(:label_project_dts_statics) %></h2>
</div>
<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| %>
<table width="600" border="2" bordercolor="red" style="padding-top: 10px; padding-left: 30px;">
<tr>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>错误变量</strong></td>
<td style="width: 120px"><%= dt.Variable %></td>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>起始行</strong></td>
<td style="width: 120px"><%= dt.StartLine %></td>
<td align="center" bgcolor="#999999" style="width: 80px"><strong>IP行</strong></td>
<td><%= dt.IPLine %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>缺陷代码</strong></td>
<td colspan="5"><%= dt.IPLineCode %></td>
</tr>
<tr>
<td align="center" bgcolor="#999999"><strong>错误描述</strong></td>
<td colspan="5"><%= dt.Description %></td>
</tr>
</table>
<% end %>

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,46 @@
<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()",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_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()",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

@ -49,6 +49,7 @@
</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>
<input type="hidden" value="<%= test.student_work_test.result%>">
</tr>
<% end%>

View File

@ -385,8 +385,15 @@ RedmineApp::Application.routes.draw do
get 'feedback', :action => 'feedback', :as => 'project_feedback'
get 'watcherlist', :action=> 'watcherlist'
get 'dts_rep', :action=> 'dts_rep'
get 'dts_yun', :action=> 'dts_yun'
# 添加dts测试工具
get 'dts_dep', :action=> 'dts_dep'
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_by_mail', :action=> 'invite_members_by_mail'
get 'send_mail_to_member', :action => 'send_mail_to_member'