<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+ <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
<% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <%= link_to activity.try(:author), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
@@ -18,15 +18,15 @@
<% if activity.parent_id.nil? %>
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
<% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
<% end %>
- <% if activity.sticky == 1%>
+ <% if activity.sticky == 1 %>
置顶
<% end%>
- <% if activity.locked%>
+ <% if activity.locked %>
- <% end%>
+ <% end %>
发帖时间:<%= format_time(activity.created_on) %>
@@ -36,9 +36,9 @@
<% if activity.parent_id.nil? %>
- <% content = activity.content%>
+ <% content = activity.content %>
<% else %>
- <% content = activity.parent.content%>
+ <% content = activity.parent.content %>
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
From c6361406b5b6b1cf0a83c348d5c7703746dc25b5 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 25 Mar 2016 14:43:51 +0800
Subject: [PATCH 05/13] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=AF=84=E6=B5=8B?=
=?UTF-8?q?=E8=B6=85=E6=97=B6=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 118 +++++++++++++++++-
.../_programing_work_show.html.erb | 25 ++--
.../users/new_user_commit_homework.html.erb | 82 ++++++------
app/views/users/user_commit_homework.html.erb | 92 +++++++-------
config/routes.rb | 2 +-
db/schema.rb | 17 +--
public/javascripts/application.js | 4 +-
public/javascripts/homework.js | 66 +++++++++-
public/stylesheets/courses.css | 1 +
public/stylesheets/public.css | 1 +
10 files changed, 293 insertions(+), 115 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index aa77e2d51..dda3291a5 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -4,14 +4,14 @@ class StudentWorkController < ApplicationController
include ApplicationHelper
require 'bigdecimal'
require "base64"
- before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
+ before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
before_filter :is_logged, :only => [:index]
- ###
+ ###
def program_test
is_test = params[:is_test] == 'true'
resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')}
@@ -48,13 +48,102 @@ class StudentWorkController < ApplicationController
resultObj[:time] = student_work_test.created_at.to_s(:db)
resultObj[:index] = student_work.student_work_tests.count
end
-
end
end
render :json => resultObj
end
+ $test_result = {}
+ $test_status = {}
+#根据传入的tIndex确定是第几次测试
+ def program_test_ex
+ is_test = params[:is_test] == 'true'
+ resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T'),tseq:1,tcount:1} #保存每测试一次返回的结果
+
+ student_work = find_or_save_student_work(is_test)
+
+ resultObj[:tcount] = @homework.homework_tests.size
+
+ unless student_work
+ resultObj[:status] = 100
+ else
+ if @homework.homework_type == 2 && @homework.homework_detail_programing
+ #找到第index个测试的输入输出
+ index = params[:tIndex].to_i
+ resultObj[:tseq] = index
+ test = @homework.homework_tests[index - 1]
+
+ #请求测试
+ result = test_realtime_ex(test, params[:src])
+ logger.debug result
+
+ #-1 默认值 0全部正确并结束 2 超时 -2 编译错误
+ resultObj[:status] = -1
+ resultObj[:results] = result["results"][0] #本次测试结果
+ resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
+
+ if result["status"].to_i == -2 #编译错误
+ resultObj[:status] = -2
+ elsif result["results"][0]["status"].to_i == 2
+ resultObj[:status] = 2
+ end
+
+ unless student_work.save
+ resultObj[:status] = 200
+ else
+
+ #索引
+ work_id = student_work.id
+
+ #测试第一个时初始化下全局变量
+ if index == 1
+ $test_result[work_id] = [] #保存本次测试的结果 输入输出
+ $test_status[work_id] = 0 #保存本次测试的结果 正确还是错误
+ end
+
+ if result["status"].to_i == -2
+ $test_result[work_id] = [result["error_msg"]]
+ $test_status[work_id] = -2
+ else
+ #存下每次的结果 只有每次都为0才全部正确
+ $test_status[work_id] = result["status"] != 0 ? result["status"]:$test_status[work_id]
+ $test_result[work_id][index - 1] = resultObj[:results]
+ end
+
+ student_work.name = params[:title]
+ student_work.description = params[:src]
+
+ if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
+ student_work.late_penalty = @homework.late_penalty
+ else
+ student_work.late_penalty = 0
+ end
+
+ #超时或编译错误则直接返回了并存入数据库
+ if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size
+ if $test_status[work_id] == 0
+ resultObj[:status] = 0
+ end
+
+ student_work_test = student_work.student_work_tests.build(status: $test_status[work_id],
+ results: $test_result[work_id],src: params[:src])
+ student_work.save
+ resultObj[:time] = student_work_test.created_at.to_s(:db)
+ resultObj[:index] = student_work.student_work_tests.count
+
+ $test_result[work_id] = nil
+ $test_status[work_id] = nil
+ end
+
+ #渲染返回结果
+ render :json => resultObj
+ end
+ end
+ end
+ end
+
+
def index
# 作业消息状态更新
@homework.course_messages.each do |homework_message|
@@ -986,7 +1075,6 @@ class StudentWorkController < ApplicationController
student_work
end
-
def test_realtime(student_work, src)
url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json"
@@ -1010,6 +1098,28 @@ class StudentWorkController < ApplicationController
JSON.parse(res.body)
end
+ def test_realtime_ex(test, src)
+ url = "#{Redmine::Configuration['judge_server']}api/realtime_test.json"
+
+ factor = []
+ factor << {input: test.input, output: test.output}
+
+ solutions = {
+ src:src,
+ language:@homework.homework_detail_programing.language,
+ factor: factor
+ }
+ uri = URI(url)
+ body = solutions.to_json
+ res = Net::HTTP.new(uri.host, uri.port).start do |client|
+ request = Net::HTTP::Post.new(uri.path)
+ request.body = body
+ request["Content-Type"] = "application/json"
+ client.request(request)
+ end
+ JSON.parse(res.body)
+ end
+
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb
index a343ae97a..241aa0c4c 100644
--- a/app/views/student_work/_programing_work_show.html.erb
+++ b/app/views/student_work/_programing_work_show.html.erb
@@ -53,27 +53,28 @@
<% else %>
- <% test.results.each_with_index do |x, i| %>
+ <% test.results.reverse.each_with_index do |x, i| %>
-
- 测试<%=i+1%>
+ 测试<%=test.results.size-i%>
<% if x["status"].to_i != 0 %>
<% if x["status"].to_i == 2 %>
- 超时!
+ 超时!
<% else %>
- 测试错误!
+ 测试错误!
<% end %>
- 测试错误!
- 耗时:
-
<%=x["time_used"]%>微秒
您的输出:
- <%=x["result"]%>
+ <%=x["result"]%>
正确输出:
- <%=x["output"]%>
+ <%=x["output"]%>
+ <% if x["status"].to_i == 2 %>
+ 耗时:
+ <%=x["time_used"]%>毫秒
+ <% end %>
<% else %>
- 测试正确!
- 耗时:
- <%=x["time_used"]%>微秒
+ 测试正确!
+
+
<% end %>
diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb
index 5a75baf7e..06d63e7c6 100644
--- a/app/views/users/new_user_commit_homework.html.erb
+++ b/app/views/users/new_user_commit_homework.html.erb
@@ -11,46 +11,48 @@
});
+
@@ -131,26 +133,28 @@
<% else %>
- <% test.results.each_with_index do |x, i| %>
- - 测试<%=i+1%>
+ <% test.results.reverse.each_with_index do |x, i| %>
+
- 测试<%=test.results.size-i%>
<% if x["status"].to_i != 0 %>
<% if x["status"].to_i == 2 %>
- 超时!
+ 超时!
<% else %>
- 测试错误!
+ 测试错误!
<% end %>
- 耗时:
-
<%=x["time_used"]%>微秒
您的输出:
- <%=x["result"]%>
+ <%=x["result"]%>
正确输出:
- <%= x["output"] %>
+ <%= x["output"] %>
+ <% if x["status"].to_i == 2 %>
+ 耗时:
+ <%=x["time_used"]%>毫秒
+ <% end %>
<% else %>
- 测试正确!
- 耗时:
- <%=x["time_used"]%>微秒
+ 测试正确!
+
+
<% end %>
diff --git a/app/views/users/user_commit_homework.html.erb b/app/views/users/user_commit_homework.html.erb
index 90b22ad14..40fd9d241 100644
--- a/app/views/users/user_commit_homework.html.erb
+++ b/app/views/users/user_commit_homework.html.erb
@@ -2,44 +2,46 @@
@@ -98,26 +100,28 @@
<% else %>
- <% test.results.each_with_index do |x, i| %>
- - 测试<%=i+1%>
+ <% test.results.reverse.each_with_index do |x, i| %>
+
- 测试<%=test.results.size-i%>
<% if x["status"].to_i != 0 %>
<% if x["status"].to_i == 2 %>
- 超时!
+ 超时!
<% else %>
- 测试错误!
+ 测试错误!
<% end %>
- 耗时:
-
<%=x["time_used"]%>微秒
您的输出:
- <%=x["result"]%>
+ <%=x["result"]%>
正确输出:
- <%=x["output"]%>
+ <%=x["output"]%>
+ <% if x["status"].to_i == 2 %>
+ 耗时:
+ <%=x["time_used"]%>毫秒
+ <% end %>
<% else %>
- 测试正确!
- 耗时:
- <%=x["time_used"]%>微秒
+ 测试正确!
+
+
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index bde12fa59..ee79bdb2a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -272,7 +272,7 @@ RedmineApp::Application.routes.draw do
get 'absence_penalty_list'
get 'evaluation_list'
# post 'set_program_score'
- post 'program_test'
+ post 'program_test_ex'
post 'set_score_rule'
end
end
diff --git a/db/schema.rb b/db/schema.rb
index 2dad292f4..d738b90c4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20160225031230) do
+ActiveRecord::Schema.define(:version => 20160311072819) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -432,9 +432,11 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.integer "resource_num"
t.integer "journal_num"
t.integer "journal_reply_num"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "total_score"
+ t.integer "homework_journal_num", :default => 0
+ t.integer "news_num", :default => 0
end
create_table "course_groups", :force => true do |t|
@@ -506,6 +508,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0
+ t.integer "visits", :default => 0
end
create_table "custom_fields", :force => true do |t|
@@ -1282,6 +1285,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "allow_guest_download", :default => true
+ t.integer "visits", :default => 0
end
create_table "phone_app_versions", :force => true do |t|
@@ -1441,6 +1445,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.integer "acts_count", :default => 0
t.integer "journals_count", :default => 0
t.integer "boards_reply_count", :default => 0
+ t.integer "visits", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@@ -1900,6 +1905,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
t.integer "gid"
+ t.integer "visits", :default => 0
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
@@ -2013,11 +2019,6 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
add_index "wikis", ["project_id"], :name => "wikis_project_id"
- create_table "wlcs", :force => true do |t|
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
create_table "workflows", :force => true do |t|
t.integer "tracker_id", :default => 0, :null => false
t.integer "old_status_id", :default => 0, :null => false
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 55d3eefad..cd6ba1cdc 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1018,6 +1018,7 @@ function showNormalImage(id) {
$(image).attr('src',_src);
return;
}
+
var element=$("").attr("href",image.attr('src'));
image.wrap(element);
$(image).parent().colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
@@ -1173,5 +1174,4 @@ function getRootPath(){
// var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
var projectName="";
return(localhostPaht+projectName);
-}
-
+}
\ No newline at end of file
diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js
index 7dd416dec..ca120df2f 100644
--- a/public/javascripts/homework.js
+++ b/public/javascripts/homework.js
@@ -31,9 +31,9 @@ $(function(){
if(!valid_form()){
return;
}
-
+ /*
$.post(
- '/student_work/program_test',
+ '/student_work/program_test_ex',
{homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test},
function(data,status){
tested = true;
@@ -44,7 +44,6 @@ $(function(){
if (typeof cb == 'function') {cb(data); return;}
-
var html=bt('t:result-list',data);
$('.ProResult').prepend(html);
@@ -56,6 +55,47 @@ $(function(){
}
}
);
+ */
+ //先测试一次并返回测试集个数及结果再判断是否需要继续进行测试
+ var test_post = function(i){
+ $.post(
+ '/student_work/program_test_ex',
+ {homework: homework_id, student_work_id: student_work_id, src: src, title: title, is_test: is_test,tIndex:i},
+ function(data,status){
+ var tSeq = data.tseq;
+ var tCount = data.tcount;
+ console.log("tSeq="+tSeq);
+ console.log("tCount="+tCount);
+ tested = true;
+ console.log(data);
+ if(data.index <=0){
+ data.index = $('.ProResultTop').length+1;
+ }
+
+ var html=bt('t:result-list',data);
+ $('.ProResult').prepend(html);
+
+ if (data.status==0 && is_test != 'true') {
+ if (typeof cb == 'function') {cb(data); return;}
+ var r=confirm("答题正确,是否立刻提交?");
+ if (r) {
+ $(".HomeWorkCon form").submit();
+ }
+ return;
+ }
+
+ //2 超时 -2 编译错误 测试结束
+ if (data.status == 2 || data.status == -2 || tSeq >= tCount ){
+ if (typeof cb == 'function') {cb(data); return;}
+ return;
+ }
+
+ test_post(i+1);
+ }
+ );
+ };
+
+ test_post(1);
};
$('#test-program-btn').on('click', test_program);
@@ -373,6 +413,10 @@ $(function(){
var src = '';
if(language==4){
src = '\
+//注意\n\
+ //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ //2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
+ //3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
import java.io.*;\n\
import java.util.*;\n\
\n\
@@ -392,8 +436,12 @@ class Main\n\
';
}
else if(language==1){
- src = '#include \n\
-\n\
+ src = '\
+//注意\n\
+ //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ //2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
+ //3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
+#include \n\
int main()\n\
{\n\
//获取参数方式 scanf\n\
@@ -409,6 +457,10 @@ int main()\n\
';
} else if(language==2){
src = '\
+//注意\n\
+ //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ //2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
+ //3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
#include \n\
using namespace std;\n\
\n\
@@ -426,6 +478,10 @@ int main()\n\
';
} else if(language==3){
src = '\
+#注意\n\
+ #1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ #2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
+ #3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
import sys \n\
\n\
#获取参数方式,使用raw_input\n\
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 108f1cd2e..f45874e2d 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -442,6 +442,7 @@ a:hover.tijiao{ background:#0f99a9;}
.members_left ul li span{ float:left; text-align:center; color:#484747;}
.w150{ text-align:center; width:150px;min-height: 10px;}
.width150{width:150px;min-height: 10px;}
+.width120{width:120px;min-height: 10px;}
.f_b{ font-weight: bold;}
.members_right label{ margin-left:15px;}
.N_search{ height:20px; border:1px solid #999;}
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css
index 6bdd8d2e2..2a7e85aa5 100644
--- a/public/stylesheets/public.css
+++ b/public/stylesheets/public.css
@@ -146,6 +146,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.w90{ width:90px;}
.w100{width: 100px;}
.w125{width:125px;}
+.w180{width:180px;}
.w210{ width:210px;}
.w150{ width:150px;}
.w170{width:170px;}
From 3af257eb77c794df27a5d90328e442688c7cba1a Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 25 Mar 2016 15:18:33 +0800
Subject: [PATCH 06/13] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E5=99=A8=E6=9C=89=E9=97=AE=E9=A2=98=E6=97=B6=E5=BE=97=E6=8F=90?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/homework.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js
index ca120df2f..f488465ca 100644
--- a/public/javascripts/homework.js
+++ b/public/javascripts/homework.js
@@ -92,7 +92,14 @@ $(function(){
test_post(i+1);
}
- );
+ ).fail(function(xhr, status){
+ if(status == 'timeout'){
+ alert("您的答案超时了, 请检查代码是否存在死循环的错误.");
+ } else {
+ alert("测试失败,服务器出错.");
+ return;
+ }
+ });
};
test_post(1);
From 0fd164d2bb1aedcac157a4d18d52b3737b6ff123 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 25 Mar 2016 15:24:31 +0800
Subject: [PATCH 07/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A8=8B?=
=?UTF-8?q?=E7=9A=84=E5=87=A0=E4=B8=AA=E6=8F=90=E7=A4=BA=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/homework.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js
index f488465ca..a932d3a70 100644
--- a/public/javascripts/homework.js
+++ b/public/javascripts/homework.js
@@ -421,7 +421,7 @@ $(function(){
if(language==4){
src = '\
//注意\n\
- //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
//3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
import java.io.*;\n\
@@ -445,7 +445,7 @@ class Main\n\
else if(language==1){
src = '\
//注意\n\
- //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
//3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
#include \n\
@@ -465,7 +465,7 @@ int main()\n\
} else if(language==2){
src = '\
//注意\n\
- //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ //1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
//3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
#include \n\
@@ -486,7 +486,7 @@ int main()\n\
} else if(language==3){
src = '\
#注意\n\
- #1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时则接下来的测试集都不会测试了\n\
+ #1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
#2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
#3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
import sys \n\
From 1f9d2ceffb15511b83e7c3c742bbdcf698cfdc2b Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 25 Mar 2016 15:38:14 +0800
Subject: [PATCH 08/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E7=BC=96?=
=?UTF-8?q?=E7=A8=8B=E7=9A=84=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/homework.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js
index a932d3a70..4f06ffe53 100644
--- a/public/javascripts/homework.js
+++ b/public/javascripts/homework.js
@@ -422,8 +422,8 @@ $(function(){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
- //2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
- //3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
+ //2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
+ //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
import java.io.*;\n\
import java.util.*;\n\
\n\
@@ -446,8 +446,8 @@ class Main\n\
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
- //2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
- //3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
+ //2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
+ //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
#include \n\
int main()\n\
{\n\
@@ -466,8 +466,8 @@ int main()\n\
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
- //2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
- //3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
+ //2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
+ //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
#include \n\
using namespace std;\n\
\n\
@@ -487,8 +487,8 @@ int main()\n\
src = '\
#注意\n\
#1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
- #2:该程序每次运行使用的内存不能超过3200字节,否则会返回错误\n\
- #3:该程序每次运行输出的结果不能超过3200个字符(最多显示100个字符),否则会返回错误\n\
+ #2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
+ #3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
import sys \n\
\n\
#获取参数方式,使用raw_input\n\
From 3c1be19702a92beb552ccb15d914ff3bce27f33c Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 25 Mar 2016 15:41:14 +0800
Subject: [PATCH 09/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A8=8B?=
=?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/homework.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js
index 4f06ffe53..b03ddf1bf 100644
--- a/public/javascripts/homework.js
+++ b/public/javascripts/homework.js
@@ -423,7 +423,7 @@ $(function(){
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
- //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
+ //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示)\n\
import java.io.*;\n\
import java.util.*;\n\
\n\
@@ -447,7 +447,7 @@ class Main\n\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
- //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
+ //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示)\n\
#include \n\
int main()\n\
{\n\
@@ -467,7 +467,7 @@ src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
- //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
+ //3:该程序每次运行输出的结果最多显示100个字符(多余的不显示)\n\
#include \n\
using namespace std;\n\
\n\
@@ -488,7 +488,7 @@ src = '\
#注意\n\
#1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
#2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
- #3:该程序每次运行输出的结果最多显示100个字符(多余的不显示),否则会返回错误\n\
+ #3:该程序每次运行输出的结果最多显示100个字符(多余的不显示)\n\
import sys \n\
\n\
#获取参数方式,使用raw_input\n\
From 9ce39d2f4a41ce9d938fbbcc20e3d33e4cc56773 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 25 Mar 2016 15:46:40 +0800
Subject: [PATCH 10/13] =?UTF-8?q?Issue=E6=A8=A1=E5=9D=97=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_logined_header.html.erb | 30 -------------------
app/views/layouts/base_projects.html.erb | 2 +-
app/views/users/_project_issue.html.erb | 7 ++---
app/views/users/_project_issue_reply.html.erb | 4 +--
4 files changed, 6 insertions(+), 37 deletions(-)
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 315b1d300..c04081128 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -24,19 +24,6 @@
+
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb
index 5d472497d..008f08706 100644
--- a/app/views/users/_project_issue.html.erb
+++ b/app/views/users/_project_issue.html.erb
@@ -73,10 +73,9 @@
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => user_activity_id, :content => activity.description} %>
+
+
<%# 局部刷新:修改xissue属性 %>
<% if User.current.member_of?(activity.project) %>
diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb
index 16d681dc9..5020f67d3 100644
--- a/app/views/users/_project_issue_reply.html.erb
+++ b/app/views/users/_project_issue_reply.html.erb
@@ -25,7 +25,7 @@
<% if count > 0 %>
- <% activity.journals.reorder("created_on desc").each do |reply| %>
+ <% activity.journals.includes(:user, :details).reorder("created_on desc").each do |reply| %>
<% unless forge_acts.empty? %>
- <% forge_acts.each do |activity| -%>
+ <% forge_acts.includes(:forge_act).each do |activity| -%>
-<% course_activities.each do |activity| if course_activities %>
+<% course_activities.includes(:course_act).each do |activity| if course_activities %>
- <% if activity && activity.course_act%>
+ <% if activity && activity.course_act %>
<% act = activity.course_act %>
<% case activity.course_act_type.to_s %>
<% when 'HomeworkCommon' %>
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb
index ee49e3cfc..e14132e85 100644
--- a/app/views/users/_course_homework.html.erb
+++ b/app/views/users/_course_homework.html.erb
@@ -151,7 +151,7 @@
<% else %>
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
<% end %>
- <% student_works.each_with_index do |sw, i| %>
+ <% student_works.includes(:user).each_with_index do |sw, i| %>