parent
fcfd17c8c9
commit
0f5fe51f97
|
@ -586,11 +586,31 @@ class AdminController < ApplicationController
|
|||
|
||||
#代码测试列表
|
||||
def code_work_tests
|
||||
@code_work_tests = StudentWorkTest.find_by_sql("select status,results,created_at, student_work_id from student_work_tests order by id desc ")
|
||||
#@code_work_tests = StudentWorkTest.find_by_sql("select a.status,a.results,a.created_at ,b.id as homeworkid,d.language from student_work_tests as a , homework_commons as b ,student_works as c, homework_detail_programings as d where a.student_work_id = c.id and b.id = c.homework_common_id and c.homework_common_id = d.homework_common_id order by a.id desc ")
|
||||
#@code_work_tests = StudentWorkTest.order('created_at desc')
|
||||
#求出所有条数
|
||||
tCount = StudentWorkTest.find_by_sql("select count(*) from code_tests").first['count(*)']
|
||||
|
||||
#设置个空的数组 以便paginateHelper来分页
|
||||
@code_work_tests = []
|
||||
@code_work_tests[tCount-1] = {}
|
||||
|
||||
@code_work_tests = paginateHelper @code_work_tests,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
||||
#取出需要的那一页数据
|
||||
tStart = @page*30
|
||||
@code_work_tests = CodeTests.find_by_sql("select * from code_tests order by id desc limit #{tStart},30 ")
|
||||
|
||||
#取出各个作业是否是模拟答题的
|
||||
is_test = {}
|
||||
@code_work_tests.each do |test|
|
||||
if is_test[test['student_work_id']] != nil
|
||||
test['is_test'] = is_test[test['student_work_id']]
|
||||
else
|
||||
test['is_test'] = CodeTests.find_by_sql("select is_test from student_works where id = #{test['student_work_id']}").first['is_test']
|
||||
is_test[test['student_work_id']] = test['is_test']
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
|
|
@ -100,8 +100,17 @@ class StudentWorkController < ApplicationController
|
|||
test = @homework.homework_tests[index - 1]
|
||||
|
||||
#请求测试
|
||||
result = test_realtime_ex(test, params[:src])
|
||||
begin
|
||||
result = test_realtime_ex(test, params[:src])
|
||||
rescue Timeout::Error
|
||||
tEndtime = Time.now
|
||||
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||
logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒"
|
||||
|
||||
#status 0:答案正确 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时
|
||||
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id)
|
||||
|
||||
end
|
||||
if result["status"].to_i != -2
|
||||
#result["results"].first['output'] = result["results"].first['output'].gsub(" ","□")
|
||||
#result["results"].first['result'] = result["results"].first['result'].gsub(" ","□")
|
||||
|
@ -116,11 +125,19 @@ class StudentWorkController < ApplicationController
|
|||
resultObj[:results] = result["results"].first #本次测试结果
|
||||
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
|
||||
|
||||
#该状态用于存入CodeTests
|
||||
tmpstatus = -1
|
||||
if result["status"].to_i == -2 #编译错误
|
||||
resultObj[:results] = result["error_msg"]
|
||||
resultObj[:status] = -2
|
||||
tmpstatus = -2
|
||||
elsif result["results"][0]["status"].to_i == 2
|
||||
resultObj[:status] = 2
|
||||
tmpstatus = 2
|
||||
end
|
||||
|
||||
if result["status"] == 0
|
||||
tmpstatus = 0
|
||||
end
|
||||
|
||||
unless student_work.save
|
||||
|
@ -136,9 +153,6 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
#每次从数据库取出上次的结果加上本次的结果再存入数据库
|
||||
tEndtime = Time.now
|
||||
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||
|
||||
if result["status"].to_i != -2
|
||||
result["results"].first['user_wait'] = tUsedtime
|
||||
|
||||
|
@ -175,11 +189,19 @@ class StudentWorkController < ApplicationController
|
|||
resultObj[:index] = student_work.student_work_tests.count
|
||||
end
|
||||
|
||||
#将每次用户等待时间都存起来以便管理界面显示用
|
||||
tEndtime = Time.now
|
||||
tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000
|
||||
|
||||
logger.debug "program_test_ex user wait time = #{tUsedtime} 毫秒"
|
||||
|
||||
time_used = 0
|
||||
if result["status"].to_i != -2
|
||||
#至少一毫秒
|
||||
time_used = result["results"].first['time_used'] == 0 ? 1:result["results"].first['time_used']
|
||||
end
|
||||
#0:答案正确 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时
|
||||
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>time_used,:wait_time=>tUsedtime,:student_work_id=>student_work.id)
|
||||
|
||||
#渲染返回结果
|
||||
render :json => resultObj
|
||||
end
|
||||
|
@ -223,6 +245,7 @@ class StudentWorkController < ApplicationController
|
|||
JSON.parse(res.body)
|
||||
end
|
||||
|
||||
#点击代码查重按钮
|
||||
def work_canrepeat
|
||||
@homework_id = params[:homework]
|
||||
@course_id = params[:course_id]
|
||||
|
@ -280,13 +303,14 @@ class StudentWorkController < ApplicationController
|
|||
render :json => resultObj
|
||||
end
|
||||
|
||||
#上次代码查重时间
|
||||
def last_codecomparetime
|
||||
resultObj = {status: 0}
|
||||
@homework = HomeworkCommon.find params[:homework]
|
||||
|
||||
#转换一下
|
||||
if @homework.simi_time != nil
|
||||
resultObj[:comparetime] = Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H:%M")
|
||||
resultObj[:comparetime] = Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H:%M:%S")
|
||||
else
|
||||
resultObj[:comparetime] = 0
|
||||
end
|
||||
|
@ -1277,7 +1301,6 @@ class StudentWorkController < ApplicationController
|
|||
request["Content-Type"] = "application/json"
|
||||
client.request(request)
|
||||
end
|
||||
|
||||
JSON.parse(res.body)
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class CodeTests < ActiveRecord::Base
|
||||
attr_accessible :homework_id, :language, :status, :time_used, :wait_time, :student_work_id
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
# encoding: utf-8
|
||||
class StudentWorkTest < ActiveRecord::Base
|
||||
attr_accessible :student_work_id, :results, :status, :src
|
||||
attr_accessible :student_work_id, :results, :status, :src, :uwait_time
|
||||
belongs_to :student_work
|
||||
|
||||
serialize :results, Array
|
||||
|
|
|
@ -10,51 +10,51 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">
|
||||
作业id
|
||||
<span style="float:left; margin-left:20px;">作业id</span>
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
<span style="float:left; margin-left:20px;">作品id</span>
|
||||
</th>
|
||||
<th style="width: 60px;">
|
||||
平均等待时间
|
||||
用户等待时间
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
语言
|
||||
<span style="float:left; margin-left:20px;">语言</span>
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
提交测试时间
|
||||
<th style="width: 100px;">
|
||||
测试完成时间
|
||||
</th>
|
||||
<th style="width: 60px;">
|
||||
<span style="float:left; margin-left:20px;">答题状态</span>
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
答题状态
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
测试集数
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
最小耗时
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
最大耗时
|
||||
<span style="float:left; margin-left:20px;">耗时</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @code_work_tests.each do |test| %>
|
||||
<% infos = StudentWorkTest.find_by_sql("select a.homework_common_id as homeworkid,b.language from student_works as a, homework_detail_programings as b where a.id = #{test.student_work_id} and a.homework_common_id = b.homework_common_id
|
||||
").first %>
|
||||
<% if infos != nil %>
|
||||
<% if test['homework_id'] != nil %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center; " title='<%=infos.homeworkid%>'>
|
||||
<%=link_to(infos.homeworkid, student_work_index_path(:homework => infos.homeworkid))%>
|
||||
<td style="text-align: center; " title='<%=test['homework_id']%>'>
|
||||
<%=link_to(test['homework_id'], student_work_index_path(:homework => test['homework_id']))%>
|
||||
</td>
|
||||
<td style="text-align: center; " title='<%=test['student_work_id']%>'>
|
||||
<% if test['is_test'] == 0 %>
|
||||
<%=link_to(test['student_work_id'], student_work_index_path(:homework => test['homework_id'],:student_work_id=>test['student_work_id']))%>
|
||||
<% else %>
|
||||
<%=link_to(test['student_work_id'], new_user_commit_homework_users_path(homework_id: test['homework_id'], is_test: true))%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<% if test.status != -2 && test.results.first['user_wait'] %>
|
||||
<% wait_time = 0 %>
|
||||
<% test.results.each do |result| wait_time = wait_time + result['user_wait'] end %>
|
||||
<%=(wait_time/test.results.count).to_s+"毫秒" %>
|
||||
<% if test.wait_time != 0 %>
|
||||
<%=test.wait_time.to_s+"毫秒" %>
|
||||
<% else %>
|
||||
<%="未记录"%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=%W(C C++ Python Java).at(infos.language.to_i - 1)%>
|
||||
<%=%W(C C++ Python Java).at(test['language'].to_i - 1)%>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=Time.parse(test.created_at.to_s).strftime("%Y-%m-%d %H:%M:%S")%>
|
||||
|
@ -64,26 +64,17 @@
|
|||
<%= "答题正确" %>
|
||||
<% elsif test.status == -2 %>
|
||||
<%= "编译错误" %>
|
||||
<% elsif test.status == 2 || test.results.last['status'] == 2 %>
|
||||
<%= "超时" %>
|
||||
<% elsif test.status == 2 %>
|
||||
<%= "代码超时" %>
|
||||
<% elsif test.status == -3 %>
|
||||
<%= "请求超时" %>
|
||||
<% else %>
|
||||
<%= "答题错误" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%=test.results.count%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%test.results = test.results.sort_by {|result| result['time_used'] }%>
|
||||
<%=test.results.first['time_used'] == 0 ? "1毫秒":test.results.first['time_used'].to_s+"毫秒"%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% if test.status != -2 %>
|
||||
<%=test.results.last['time_used'] == 0 ? "1毫秒":test.results.last['time_used'].to_s+"毫秒"%>
|
||||
<% if test.time_used > 0 %>
|
||||
<%=test.time_used.to_s+"毫秒"%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<h2 class="conbox-h2">查重结果</h2>
|
||||
<div class="chabox">
|
||||
<ul class="chabox-header">
|
||||
<li class="chabox-w-500" style = "width:438px" >被查作品</li>
|
||||
<li class="chabox-w-500" style = "width:560px" >疑被抄袭作品</li>
|
||||
<li class="chabox-w-500" style = "width:437px" >被查作品</li>
|
||||
<li class="chabox-w-500" style = "width:561px" >疑被抄袭作品</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="chabox-top">
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
<% end %>
|
||||
</span>
|
||||
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3 || @homework.is_open == 1%>
|
||||
<div class="hworkSearchBox">
|
||||
<div class="hworkSearchBox mr15">
|
||||
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
|
||||
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
|
||||
</div>
|
||||
<%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit fl mr20"}) unless course_group_list(@course).empty? %>
|
||||
<%if @homework.homework_type == 2 && @is_teacher %>
|
||||
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fr',:remote => true %>
|
||||
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %>
|
||||
<% end %>
|
||||
<%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
|
||||
<% end%>
|
||||
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示作业信息 ]</a> </span>
|
||||
</div>
|
||||
|
@ -50,8 +50,12 @@
|
|||
<script type="text/javascript">
|
||||
|
||||
$(function(){
|
||||
<% if !@is_evaluation && (!@is_teacher || params[:show_work_id].present?) %>
|
||||
<% work= params[:show_work_id].nil? ? @homework.student_works.where("user_id = ?",User.current.id).first : StudentWork.find(params[:show_work_id]) %>
|
||||
<% if !@is_evaluation && (!@is_teacher || params[:show_work_id].present?) || @message_student_work_id %>
|
||||
<% if @message_student_work_id %>
|
||||
<% work = @homework.student_works.where("id =?", @message_student_work_id).first %>
|
||||
<% else %>
|
||||
<% work= params[:show_work_id].nil? ? @homework.student_works.where("user_id = ?",User.current.id).first : StudentWork.find(params[:show_work_id]) %>
|
||||
<% end %>
|
||||
<% unless work.nil? %>
|
||||
<% if @homework.homework_type == 2 %>
|
||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
|
||||
|
@ -89,146 +93,5 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
});
|
||||
//代码查重
|
||||
function code_repeat(){
|
||||
|
||||
var homework_id = <%=@homework.id%>;
|
||||
var course_id = <%=@course.id%>;
|
||||
|
||||
console.log("course_id=",course_id);
|
||||
console.log("homework_id=",homework_id);
|
||||
|
||||
if(<%= @stundet_works.count <=1 %>)
|
||||
{
|
||||
//弹框
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起该作业的作品过少不能查重!",:status=>0, :homework=> @homework,:courseid=> @course.id})%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//先请求下上次查询的时间
|
||||
$.post(
|
||||
'/student_work/last_codecomparetime',
|
||||
{homework: homework_id},
|
||||
function(data,status){
|
||||
if (data.status == 0) {
|
||||
var homework_simi_time = data.comparetime;
|
||||
|
||||
if (homework_simi_time == 0){
|
||||
//没进行过代码查重则直接查重
|
||||
test_repeat();
|
||||
}
|
||||
else{
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_1',:locals => {:homework=> @homework,:courseid=> @course.id })%>');
|
||||
$('#compare-tips-1').html('您上次查重的时间为'+homework_simi_time);
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
console.log(homework_simi_time);
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
).fail(function(xhr, status){
|
||||
// confirm("对不起,服务器繁忙请稍后再试!");
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起,服务器繁忙请稍后再试!",:status=>0, :homework=> @homework,:courseid=> @course.id})%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
return;
|
||||
});
|
||||
|
||||
//请求查重
|
||||
var test_repeat = function(){
|
||||
$.post(
|
||||
'/student_work/code_repeattest',
|
||||
{homework: homework_id},
|
||||
function(data,status){
|
||||
console.log("result = ");
|
||||
console.log(data);
|
||||
|
||||
if (data.status == 0) {
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"查重完成是否立即查看结果?",:status=>1, :homework=> @homework,:courseid=> @course.id})%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
}
|
||||
else if (data.status == -1){
|
||||
// confirm("对不起只支持java/c/c++的代码查重!");
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起目前只支持java/c/c++的代码查重!",:status=>0, :homework=> @homework,:courseid=> @course.id})%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
|
||||
}
|
||||
else if (data.status == -2){
|
||||
// confirm("对不起该作业的作品过少不能查重!");
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起该作业的作品过少不能查重!",:status=>0, :homework=> @homework,:courseid=> @course.id})%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
).fail(function(xhr, status){
|
||||
// confirm("对不起,服务器繁忙请稍后再试!");
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起,服务器繁忙请稍后再试!",:status=>0, :homework=> @homework,:courseid=> @course.id})%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 560px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
||||
function closeModal(){
|
||||
hideModal($(".blue-border-box"));
|
||||
}
|
||||
return;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
</script>
|
|
@ -81,7 +81,7 @@
|
|||
test_repeat();
|
||||
<% else%>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_1',:locals => {:homework=> @homework,:courseid=>@course_id })%>');
|
||||
$('#compare-tips-1').html('您上次查重的时间为<%= Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H-%M-%S")%>');
|
||||
$('#compare-tips-1').html('您上次查重的时间为<%= Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H:%M:%S")%>');
|
||||
showModal('ajax-modal', '580px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
class CreateCodeTests < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :code_tests do |t|
|
||||
t.integer :homework_id
|
||||
t.integer :wait_time, default: 0
|
||||
t.integer :language
|
||||
t.integer :status
|
||||
t.integer :time_used, default: 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddStudentWorkIdToCodeTests < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :code_tests, :student_work_id, :integer,:default=>0
|
||||
end
|
||||
end
|
16
db/schema.rb
16
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160330103916) do
|
||||
ActiveRecord::Schema.define(:version => 20160419074016) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -334,6 +334,17 @@ ActiveRecord::Schema.define(:version => 20160330103916) do
|
|||
t.boolean "diff_all"
|
||||
end
|
||||
|
||||
create_table "code_tests", :force => true do |t|
|
||||
t.integer "homework_id"
|
||||
t.integer "wait_time", :default => 0
|
||||
t.integer "language"
|
||||
t.integer "status"
|
||||
t.integer "time_used", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "student_work_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
t.string "commented_type", :limit => 30, :default => "", :null => false
|
||||
t.integer "commented_id", :default => 0, :null => false
|
||||
|
@ -1290,6 +1301,7 @@ ActiveRecord::Schema.define(:version => 20160330103916) do
|
|||
t.datetime "updated_at", :null => false
|
||||
t.string "field_type"
|
||||
t.integer "hide", :default => 0
|
||||
t.integer "status", :default => 1
|
||||
end
|
||||
|
||||
create_table "organizations", :force => true do |t|
|
||||
|
@ -1302,6 +1314,7 @@ ActiveRecord::Schema.define(:version => 20160330103916) do
|
|||
t.datetime "updated_at", :null => false
|
||||
t.boolean "allow_guest_download", :default => true
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "show_mode", :default => 0
|
||||
end
|
||||
|
||||
create_table "phone_app_versions", :force => true do |t|
|
||||
|
@ -1666,6 +1679,7 @@ ActiveRecord::Schema.define(:version => 20160330103916) do
|
|||
t.integer "status", :default => 9
|
||||
t.text "results"
|
||||
t.text "src"
|
||||
t.integer "uwait_time", :default => 0
|
||||
end
|
||||
|
||||
create_table "student_works", :force => true do |t|
|
||||
|
|
|
@ -2847,29 +2847,4 @@ img.school_avatar {
|
|||
}
|
||||
|
||||
.admin_message_warn{font-size: 12px;color: red;}
|
||||
a.btn_message_free{ background:#15BCCF; display:block; text-align:center; color:#fff; padding:3px 0; width:60px; margin-bottom:10px;margin-left: 58px;}
|
||||
|
||||
/*20160401袁可------------------ 查重结果样式*/
|
||||
.conbox{ width:1000px; margin:0 auto; border:3px solid #f0f0f0; background:#fff;}
|
||||
.conbox-h2{ font-size:16px; padding:10px 0; padding-left:25px;}
|
||||
.chabox{ width:1000px;}
|
||||
.chabox ul li{ float:left; width:82px; text-align:center; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
|
||||
.chabox ul li.chabox-w-401{ width:151px; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
|
||||
.chabox ul li.chabox-r-line{ border-right:1px solid #D1D1D1;}
|
||||
.chabox-top{ width:1000px; }
|
||||
.chabox-top li{ font-size:14px; font-weight:bold; line-height:40px; height:40px; background:#E4E4E4; color:#000;}
|
||||
.chabox-con li{font-size:12px; line-height:35px; height:35px; color:#888; border-bottom:1px solid #DFDFDF;}
|
||||
a.cha-btn{ display:block; width:50px; height:20px; line-height:20px; margin:0 auto; border:1px solid #269ac9; color:#269ac9;-webkit-border-radius: 3px;border-radius:3px; margin-top:8px;}
|
||||
a:hover.cha-btn{ background:#269ac9; color:#fff;}
|
||||
.chabox-header li{ font-size:14px; font-weight:bold; line-height:40px; height:40px; border-top:1px solid #E4E4E4; border-right:1px solid #E4E4E4; color:#000;}
|
||||
.chabox ul li.chabox-w-500{ width:499px;}
|
||||
.chabox ul li.chabox-w-40{ width:39px; border-right:1px solid #D1D1D1;}
|
||||
.chabox ul li.chabox-txt-left{ text-align:left;text-indent:1em; }
|
||||
|
||||
.contrast-box{ width:1200px;box-shadow: 0 0 5px #6B6B6B; background:#fff; margin:0 auto; }
|
||||
.contrast-con{ width:599px; border-right:1px solid #D1D1D1; float:left;}
|
||||
.contrast-con h3{font-size:14px; font-weight:bold; line-height:40px; height:40px; background:#E4E4E4; color:#000; text-align:center; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
|
||||
.contrast-txt{ padding:10px;}
|
||||
.showCodeC{ width:580px; float:left;}
|
||||
|
||||
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
||||
a.btn_message_free{ background:#15BCCF; display:block; text-align:center; color:#fff; padding:3px 0; width:60px; margin-bottom:10px;margin-left: 58px;}
|
|
@ -1452,3 +1452,28 @@ ul.contest-notification-list li span{
|
|||
color: #136b3b !important;
|
||||
font-weight:normal !important;
|
||||
}
|
||||
|
||||
/*20160401袁可------------------ 查重结果样式*/
|
||||
.conbox{ width:1000px; margin:0 auto; border:3px solid #f0f0f0; background:#fff;}
|
||||
.conbox-h2{ font-size:16px; padding:10px 0; padding-left:25px;}
|
||||
.chabox{ width:1000px;}
|
||||
.chabox ul li{ float:left; width:82px; text-align:center; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
|
||||
.chabox ul li.chabox-w-401{ width:151px; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
|
||||
.chabox ul li.chabox-r-line{ border-right:1px solid #D1D1D1;}
|
||||
.chabox-top{ width:1000px; }
|
||||
.chabox-top li{ font-size:14px; font-weight:bold; line-height:40px; height:40px; background:#E4E4E4; color:#000;}
|
||||
.chabox-con li{font-size:12px; line-height:35px; height:35px; color:#888; border-bottom:1px solid #DFDFDF;}
|
||||
a.cha-btn{ display:block; width:50px; height:20px; line-height:20px; margin:0 auto; border:1px solid #269ac9; color:#269ac9;-webkit-border-radius: 3px;border-radius:3px; margin-top:8px;}
|
||||
a:hover.cha-btn{ background:#269ac9; color:#fff;}
|
||||
.chabox-header li{ font-size:14px; font-weight:bold; line-height:40px; height:40px; border-top:1px solid #E4E4E4; border-right:1px solid #E4E4E4; color:#000;}
|
||||
.chabox ul li.chabox-w-500{ width:499px;}
|
||||
.chabox ul li.chabox-w-40{ width:39px; border-right:1px solid #D1D1D1;}
|
||||
.chabox ul li.chabox-txt-left{ text-align:left;text-indent:1em; }
|
||||
|
||||
.contrast-box{ width:1200px;box-shadow: 0 0 5px #6B6B6B; background:#fff; margin:0 auto; }
|
||||
.contrast-con{ width:599px; border-right:1px solid #D1D1D1; float:left;}
|
||||
.contrast-con h3{font-size:14px; font-weight:bold; line-height:40px; height:40px; background:#E4E4E4; color:#000; text-align:center; display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
|
||||
.contrast-txt{ padding:10px;}
|
||||
.showCodeC{ width:580px; float:left;}
|
||||
|
||||
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
FactoryGirl.define do
|
||||
factory :code_test, :class => 'CodeTests' do
|
||||
homework_id 1
|
||||
wait_time 1
|
||||
language 1
|
||||
status 1
|
||||
time_used "MyString"
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CodeTests, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue