From bb08c7160fe93453fb3cbbe1b2b7d93ed16f09a6 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 21 Jul 2015 15:52:40 +0800
Subject: [PATCH 01/16] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E9=83=A8=E5=88=86=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 44 +++++++++----------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index e71fd5e29..04a07e9a8 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- # @homework_type = "1"
- #
- # @homework = HomeworkCommon.new
- # @homework.safe_attributes = params[:homework_common]
- # @homework.late_penalty = 0
- # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
- #
- # if @homework_type == "1"
- # #匿评作业相关属性
- # @homework_detail_manual = HomeworkDetailManual.new
- # @homework_detail_manual.ta_proportion = 0.6
- # @homework_detail_manual.absence_penalty = 0
- # @homework_detail_manual.evaluation_num = 3
- # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.homework_detail_manual = @homework_detail_manual
- # elsif @homework_type == "2"
- # #编程作业相关属性
- # @homework_detail_programing = HomeworkDetailPrograming.new
- # @homework.homework_detail_programing = @homework_detail_programing
- # end
+ @homework_type = "1"
+
+ @homework = HomeworkCommon.new
+ @homework.safe_attributes = params[:homework_common]
+ @homework.late_penalty = 0
+ @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+
+ if @homework_type == "1"
+ #匿评作业相关属性
+ @homework_detail_manual = HomeworkDetailManual.new
+ @homework_detail_manual.ta_proportion = 0.6
+ @homework_detail_manual.absence_penalty = 0
+ @homework_detail_manual.evaluation_num = 3
+ @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.homework_detail_manual = @homework_detail_manual
+ elsif @homework_type == "2"
+ #编程作业相关属性
+ @homework_detail_programing = HomeworkDetailPrograming.new
+ @homework.homework_detail_programing = @homework_detail_programing
+ end
respond_to do |format|
format.html
end
From 9a4a1594630575261c2d2686de9b3e0501025422 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 21 Jul 2015 16:34:48 +0800
Subject: [PATCH 02/16] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E5=8F=96=E6=B6=88?=
=?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 44 +++++++++----------
app/views/homework_common/new.html.erb | 28 ++++--------
2 files changed, 31 insertions(+), 41 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 04a07e9a8..e71fd5e29 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- @homework_type = "1"
-
- @homework = HomeworkCommon.new
- @homework.safe_attributes = params[:homework_common]
- @homework.late_penalty = 0
- @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- @homework.publish_time = Time.now.strftime('%Y-%m-%d')
-
- if @homework_type == "1"
- #匿评作业相关属性
- @homework_detail_manual = HomeworkDetailManual.new
- @homework_detail_manual.ta_proportion = 0.6
- @homework_detail_manual.absence_penalty = 0
- @homework_detail_manual.evaluation_num = 3
- @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- @homework.homework_detail_manual = @homework_detail_manual
- elsif @homework_type == "2"
- #编程作业相关属性
- @homework_detail_programing = HomeworkDetailPrograming.new
- @homework.homework_detail_programing = @homework_detail_programing
- end
+ # @homework_type = "1"
+ #
+ # @homework = HomeworkCommon.new
+ # @homework.safe_attributes = params[:homework_common]
+ # @homework.late_penalty = 0
+ # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+ #
+ # if @homework_type == "1"
+ # #匿评作业相关属性
+ # @homework_detail_manual = HomeworkDetailManual.new
+ # @homework_detail_manual.ta_proportion = 0.6
+ # @homework_detail_manual.absence_penalty = 0
+ # @homework_detail_manual.evaluation_num = 3
+ # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ # @homework.homework_detail_manual = @homework_detail_manual
+ # elsif @homework_type == "2"
+ # #编程作业相关属性
+ # @homework_detail_programing = HomeworkDetailPrograming.new
+ # @homework.homework_detail_programing = @homework_detail_programing
+ # end
respond_to do |format|
format.html
end
diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb
index cdc2ceca0..6fc0fff0e 100644
--- a/app/views/homework_common/new.html.erb
+++ b/app/views/homework_common/new.html.erb
@@ -1,27 +1,17 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
+<%= error_messages_for 'homework_common' %>
- <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
-
-
- 请选择将要发布的作业类型
-
-
-
- 人工评分的作业(支持匿名互评、灵活设置评分比例)
-
-
-
-
- 自动评测的编程作业(支持C/C++程序的自动评分)
-
-
-
- 下一步
-
+
+ <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
+ <%= hidden_field_tag "course",@course.id%>
+ <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
+
提交
+ <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
+ <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
From 45dd135c819f71db1062e0c10a5240d372265108 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 21 Jul 2015 16:39:23 +0800
Subject: [PATCH 03/16] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 44 +++++++++----------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index e71fd5e29..04a07e9a8 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- # @homework_type = "1"
- #
- # @homework = HomeworkCommon.new
- # @homework.safe_attributes = params[:homework_common]
- # @homework.late_penalty = 0
- # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
- #
- # if @homework_type == "1"
- # #匿评作业相关属性
- # @homework_detail_manual = HomeworkDetailManual.new
- # @homework_detail_manual.ta_proportion = 0.6
- # @homework_detail_manual.absence_penalty = 0
- # @homework_detail_manual.evaluation_num = 3
- # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.homework_detail_manual = @homework_detail_manual
- # elsif @homework_type == "2"
- # #编程作业相关属性
- # @homework_detail_programing = HomeworkDetailPrograming.new
- # @homework.homework_detail_programing = @homework_detail_programing
- # end
+ @homework_type = "1"
+
+ @homework = HomeworkCommon.new
+ @homework.safe_attributes = params[:homework_common]
+ @homework.late_penalty = 0
+ @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+
+ if @homework_type == "1"
+ #匿评作业相关属性
+ @homework_detail_manual = HomeworkDetailManual.new
+ @homework_detail_manual.ta_proportion = 0.6
+ @homework_detail_manual.absence_penalty = 0
+ @homework_detail_manual.evaluation_num = 3
+ @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.homework_detail_manual = @homework_detail_manual
+ elsif @homework_type == "2"
+ #编程作业相关属性
+ @homework_detail_programing = HomeworkDetailPrograming.new
+ @homework.homework_detail_programing = @homework_detail_programing
+ end
respond_to do |format|
format.html
end
From d9f312bbe3574a352fd8f473ef81421cbb9a7701 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 09:56:27 +0800
Subject: [PATCH 04/16] =?UTF-8?q?1=E3=80=81=E5=BD=93=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E6=8F=8F=E8=BF=B0=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=89=93?=
=?UTF-8?q?=E5=BC=80=E4=BD=9C=E5=93=81=E6=8A=A5=E9=94=99=202=E3=80=81?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E5=90=8D=E7=A7=B0=E4=B8=BA=E7=A9=BA=E6=97=B6?=
=?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E5=90=8D=E4=B8=BA=EF=BC=9AXX=E7=9A=84=E4=BD=9C=E5=93=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_evaluation_student_work.html.erb | 3 ++-
app/views/student_work/_evaluation_work.html.erb | 3 ++-
app/views/student_work/_show.html.erb | 2 +-
app/views/student_work/_student_work.html.erb | 3 ++-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/app/views/student_work/_evaluation_student_work.html.erb b/app/views/student_work/_evaluation_student_work.html.erb
index b5bdd6f55..9569718fb 100644
--- a/app/views/student_work/_evaluation_student_work.html.erb
+++ b/app/views/student_work/_evaluation_student_work.html.erb
@@ -9,7 +9,8 @@
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
- <%= link_to student_work.name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
+ <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
+ <%= link_to student_work_name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb
index 11ce7b080..be07269c3 100644
--- a/app/views/student_work/_evaluation_work.html.erb
+++ b/app/views/student_work/_evaluation_work.html.erb
@@ -18,7 +18,8 @@
<% end%>
- <%= link_to student_work.name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%>
+ <% student_work_name = student_work.name.nil? || student_work.name.empty? ? '匿名的作品' : student_work.name%>
+ <%= link_to student_work_name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%>
<% my_score = student_work_score(student_work,User.current) %>
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 2b7d49402..f6580659e 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -36,7 +36,7 @@
内容:
- <%= text_format @work.description%>
+ <%= text_format(@work.description) if @work.description%>
diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb
index dd7ab7e2d..f7eb7514d 100644
--- a/app/views/student_work/_student_work.html.erb
+++ b/app/views/student_work/_student_work.html.erb
@@ -9,7 +9,8 @@
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
- <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
+ <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
+ <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
From ae4eed45c3167af958be6145ce7d4aed3beb84c8 Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 22 Jul 2015 10:05:21 +0800
Subject: [PATCH 05/16] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=96=B0=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E5=B7=A5=E5=85=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/projects/_tools_expand.html.erb | 116 ++++++++--------------
config/locales/projects/zh.yml | 2 +-
2 files changed, 45 insertions(+), 73 deletions(-)
diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb
index 4cf7ebcab..85c8ca6b1 100644
--- a/app/views/projects/_tools_expand.html.erb
+++ b/app/views/projects/_tools_expand.html.erb
@@ -43,97 +43,69 @@
<% if User.current.admin? %>
- 软件知识库
- <%#= link_to l(:label_project_soft_knowledge) ,soft_knowledge_project_path(@project) %>
- <% end %>
-
-
- <% if User.current.admin? %>
- 软件资源库
- <%#= link_to l(:label_project_soft_file) ,soft_file_project_path(@project) %>
- <% end %>
-
-
-
- <% if User.current.admin? %>
- <%= link_to l(:label_project_dts_new) ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %>
- <% end %>
-
-
-
- <% if User.current.admin? %>
- 在线开发平台
- <%#= link_to l(:label_project_online_dev) ,online_dev_project_path(@project) %>
- <% end %>
-
-
- <% if User.current.admin? %>
- 软工服务平台
+ QoS评估工具
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
-
<% if User.current.admin? %>
- 形式验证工具
+ QoS证据采集工具
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
-
<% if User.current.admin? %>
- QoS 评估工具
+ QoS证据评估统计分析工具
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
-
<% if User.current.admin? %>
- QoS 证据采集工具
- <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
+ <%= link_to "代码缺陷测试工具(DTS)" ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %>
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 软工服务平台(SASSP)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 软件知识库(KnowledgeBase)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 可信评估工具(Evaluator)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 在线验证工具(BACH-Online)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 软件测试工具(SSCC-Web)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 服务资源共享平台(ServiceXchange)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 在线服务开发平台(ServiceFoundry)
+ <% end %>
+
+
+ <% if User.current.admin? %>
+ 组合开发和运行演化平台(Service4All)
<% end %>
-
- <% if User.current.admin? %>
- 可信度评估工具 SAS
-
- <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
- <% end %>
-
-
- <% if User.current.admin? %>
- 可信评估工具 Evaluator
- <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
- <% end %>
-
-
- <% if User.current.admin? %>
- 软件测试工具 SSCC-Web
- <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
- <% end %>
-
-
-
-
-
-
-
-
- <% if User.current.admin? %>
- QoS 证据评估统计分析工具
- <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
- <% end %>
-
-
-
- <% if User.current.admin? %>
- 在线验证工具 BACH-Online
- <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
- <% end %>
-
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml
index e1971cfb9..6c2646acf 100644
--- a/config/locales/projects/zh.yml
+++ b/config/locales/projects/zh.yml
@@ -92,7 +92,7 @@ zh:
label_project_dts_new: 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: 在线开发平台
From 5bd1cdc4eb20464bf37aee1747e2e2630d415074 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 10:06:55 +0800
Subject: [PATCH 06/16] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E7=9A=84=E5=AD=98=E5=82=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 1 +
app/models/student_work_test.rb | 2 +-
.../20150722015428_add_errormsg_to_studen_work_test.rb | 9 +++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 209fa7269..e885a780a 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController
if student_work_test.result == 0
student_score_count += 1
end
+ student_work_test.error_msg = params[:compile_error_msg]
student_work_test.save!
end
end
diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb
index 2e6efdf0a..413528b82 100644
--- a/app/models/student_work_test.rb
+++ b/app/models/student_work_test.rb
@@ -1,6 +1,6 @@
# encoding: utf-8
class StudentWorkTest < ActiveRecord::Base
- attr_accessible :student_work_id, :homework_test_id, :result
+ attr_accessible :student_work_id, :homework_test_id, :result, :error_msg
belongs_to :homework_test
belongs_to :student_work
diff --git a/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb
new file mode 100644
index 000000000..e3f0611db
--- /dev/null
+++ b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb
@@ -0,0 +1,9 @@
+class AddErrormsgToStudenWorkTest < ActiveRecord::Migration
+ def up
+ add_column :student_work_tests,:error_msg,:text
+ end
+
+ def down
+ remove_column :student_work_tests,:error_msg,
+ end
+end
From ec4395c30c9460c0d5a9b7f84cbbbce9dc5f65df Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 10:18:01 +0800
Subject: [PATCH 07/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E6=9D=83=E9=99=90=E5=AF=B9admin=E7=94=A8=E6=88=B7=E5=85=AC?=
=?UTF-8?q?=E5=BC=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index e885a780a..da2575456 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -157,7 +157,7 @@ class StudentWorkController < ApplicationController
end
def edit
- if @homework.homework_type == 2 #编程作业不能修改作业
+ if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业
render_403
else
respond_to do |format|
@@ -445,7 +445,7 @@ class StudentWorkController < ApplicationController
#判断是不是当前作品的提交者
#提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品
def author_of_work
- render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
+ render_403 unless User.current.admin? || (User.current.id == @work.user_id && @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
def teacher_of_course
From b148f75dc9815e7ff46e22933ce7ef01a3533367 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Wed, 22 Jul 2015 10:22:50 +0800
Subject: [PATCH 08/16] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A2=98?=
=?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/news/_course_news.html.erb | 79 +++++++----------------
app/views/news/_course_news_list.html.erb | 47 ++++++++++++++
app/views/news/index.js.erb | 1 +
3 files changed, 72 insertions(+), 55 deletions(-)
create mode 100644 app/views/news/_course_news_list.html.erb
create mode 100644 app/views/news/index.js.erb
diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb
index c89f0af26..f801aff87 100644
--- a/app/views/news/_course_news.html.erb
+++ b/app/views/news/_course_news.html.erb
@@ -2,70 +2,39 @@
btn_tips = l(:label_news_notice)
label_tips = l(:label_course_news)
%>
+
<%= label_tips %>
-
- <%= l(:label_total_news) %>
- <%= @news_count %>
- <%= l(:label_course_news_count) %>
-
- <% if @course && User.current.allowed_to?(:manage_news, @course) %>
- <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%>
-
+
+
+ <%= l(:label_total_news) %>
+ <%= @news_count %>
+ <%= l(:label_course_news_count) %>
+
+ <% if @course && User.current.allowed_to?(:manage_news, @course) %>
+ <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%>
+
- <% end %>
+ <% end %>
+
+
+ <%= form_tag({:controller => 'news', :action => 'index', :course_id => @course },:remote=>'true', :method => :get,:id=>"news_query_form", :class => 'query_form') do %>
+
+
搜索
+ <% end %>
+
+
+ <%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %>
- <% if @newss.empty? %>
-
- <%= l(:label_no_data) %>
-
- <% else %>
- <% @newss.each do |news| %>
-
- <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
-
- <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
-
- <%= l(:label_release_news) %>:
-
- <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
- <%=link_to "
#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %>
-
-
-
-
-
- <%= news.description.html_safe %>
-
-
-
-
-
-
<%= l(:label_create_time)%>:<%= format_time(news.created_on)%>
- <%= link_to_attachments_course news %>
-
- <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %>
-
-
-
-
- <% end %>
- <% end %>
-
-
-
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
-
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %>
diff --git a/app/views/news/_course_news_list.html.erb b/app/views/news/_course_news_list.html.erb
new file mode 100644
index 000000000..da963b3cd
--- /dev/null
+++ b/app/views/news/_course_news_list.html.erb
@@ -0,0 +1,47 @@
+
+<% if newss.empty? %>
+
+ <%= l(:label_no_data) %>
+
+<% else %>
+ <% newss.each do |news| %>
+
+ <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
+
+ <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
+
+ <%= l(:label_release_news) %>:
+
+ <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
+ <%=link_to "
#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %>
+
+
+
+
+
+ <%= news.description.html_safe %>
+
+
+
+
+
+
<%= l(:label_create_time)%>:<%= format_time(news.created_on)%>
+ <%= link_to_attachments_course news %>
+
+ <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %>
+
+
+
+
+ <% end %>
+<% end %>
+
+
+
+
+ <%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
\ No newline at end of file
diff --git a/app/views/news/index.js.erb b/app/views/news/index.js.erb
new file mode 100644
index 000000000..04671917b
--- /dev/null
+++ b/app/views/news/index.js.erb
@@ -0,0 +1 @@
+$("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>");
\ No newline at end of file
From ffe12b92c83a0a45c82f601352fddfef8644f716 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Wed, 22 Jul 2015 10:23:14 +0800
Subject: [PATCH 09/16] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A2=98?=
=?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/news_controller.rb | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 56b4a30fc..9385c73ee 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -73,8 +73,14 @@ class NewsController < ApplicationController
@news_count = scope.count
#@news_pages = Paginator.new @news_count, @limit, params['page']
#@offset ||= scope_page.offset
- scope_order = scope.all(:include => [:author, :course],
- :order => "#{News.table_name}.created_on DESC")
+ if params[:subject].nil?
+ scope_order = scope.all(:include => [:author, :course],
+ :order => "#{News.table_name}.created_on DESC")
+ else
+ scope_order = scope.where("news.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course],
+ :order => "#{News.table_name}.created_on DESC")
+ end
+
# :offset => @offset,
# :limit => @limit)
@newss = paginateHelper scope_order,10
@@ -83,6 +89,7 @@ class NewsController < ApplicationController
@news = News.new
render :layout => 'base_courses'
}
+ format.js
format.api
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
end
@@ -141,7 +148,7 @@ class NewsController < ApplicationController
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
end
- # ض̬ļ¼add start
+ # ������ض�̬�ļ�¼add start
teachers = searchTeacherAndAssistant(@course)
for teacher in teachers
if(teacher.user_id != User.current.id)
@@ -155,7 +162,7 @@ class NewsController < ApplicationController
notify.save()
end
end
- # ض̬ļ¼add end
+ # ������ض�̬�ļ�¼add end
render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create)
redirect_to course_news_index_url(@course)
From baccd28493292b0453d61a2ad47aac4d44684efa Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 10:48:46 +0800
Subject: [PATCH 10/16] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E5=87=BA=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb
index e3f0611db..dc973e142 100644
--- a/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb
+++ b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb
@@ -4,6 +4,6 @@ class AddErrormsgToStudenWorkTest < ActiveRecord::Migration
end
def down
- remove_column :student_work_tests,:error_msg,
+ remove_column :student_work_tests,:error_msg
end
end
From 66924560c41d176479e3166b50acd89c4fe09d7a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 16:06:31 +0800
Subject: [PATCH 11/16] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E4=B8=8A=E7=BA=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 44 +++++++++----------
app/views/homework_common/new.html.erb | 28 ++++++++----
db/schema.rb | 3 +-
3 files changed, 43 insertions(+), 32 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 04a07e9a8..e71fd5e29 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- @homework_type = "1"
-
- @homework = HomeworkCommon.new
- @homework.safe_attributes = params[:homework_common]
- @homework.late_penalty = 0
- @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- @homework.publish_time = Time.now.strftime('%Y-%m-%d')
-
- if @homework_type == "1"
- #匿评作业相关属性
- @homework_detail_manual = HomeworkDetailManual.new
- @homework_detail_manual.ta_proportion = 0.6
- @homework_detail_manual.absence_penalty = 0
- @homework_detail_manual.evaluation_num = 3
- @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- @homework.homework_detail_manual = @homework_detail_manual
- elsif @homework_type == "2"
- #编程作业相关属性
- @homework_detail_programing = HomeworkDetailPrograming.new
- @homework.homework_detail_programing = @homework_detail_programing
- end
+ # @homework_type = "1"
+ #
+ # @homework = HomeworkCommon.new
+ # @homework.safe_attributes = params[:homework_common]
+ # @homework.late_penalty = 0
+ # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+ #
+ # if @homework_type == "1"
+ # #匿评作业相关属性
+ # @homework_detail_manual = HomeworkDetailManual.new
+ # @homework_detail_manual.ta_proportion = 0.6
+ # @homework_detail_manual.absence_penalty = 0
+ # @homework_detail_manual.evaluation_num = 3
+ # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ # @homework.homework_detail_manual = @homework_detail_manual
+ # elsif @homework_type == "2"
+ # #编程作业相关属性
+ # @homework_detail_programing = HomeworkDetailPrograming.new
+ # @homework.homework_detail_programing = @homework_detail_programing
+ # end
respond_to do |format|
format.html
end
diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb
index 6fc0fff0e..cdc2ceca0 100644
--- a/app/views/homework_common/new.html.erb
+++ b/app/views/homework_common/new.html.erb
@@ -1,17 +1,27 @@
-<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
-<%= error_messages_for 'homework_common' %>
<%= l(:label_course_homework_new)%>
-
- <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
- <%= hidden_field_tag "course",@course.id%>
- <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
-
提交
- <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
- <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
+
+ <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
+
+
+ 请选择将要发布的作业类型
+
+
+
+ 人工评分的作业(支持匿名互评、灵活设置评分比例)
+
+
+
+
+ 自动评测的编程作业(支持C/C++程序的自动评分)
+
+
+
+ 下一步
+
<% end%>
diff --git a/db/schema.rb b/db/schema.rb
index 243079ed8..fb0f17ff3 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 => 20150719092427) do
+ActiveRecord::Schema.define(:version => 20150722015428) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -1248,6 +1248,7 @@ ActiveRecord::Schema.define(:version => 20150719092427) do
t.integer "result"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.text "error_msg"
end
create_table "student_works", :force => true do |t|
From 01576449c81bd92f2ec9eba78fc8f188038eb23a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 16:33:27 +0800
Subject: [PATCH 12/16] =?UTF-8?q?=E7=BC=96=E8=AF=91=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/homework_test.rb | 2 +-
app/views/student_work/_programing_work_show.html.erb | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb
index 7c477bfaf..4ed290ecd 100644
--- a/app/models/homework_test.rb
+++ b/app/models/homework_test.rb
@@ -2,5 +2,5 @@ class HomeworkTest < ActiveRecord::Base
attr_accessible :input, :output, :homework_common_id
belongs_to :homework_common
- has_one :student_work_test
+ has_many :student_work_test
end
diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb
index eab8313bc..9b5035a04 100644
--- a/app/views/student_work/_programing_work_show.html.erb
+++ b/app/views/student_work/_programing_work_show.html.erb
@@ -47,8 +47,9 @@
<%= test.output%>
|
-
<%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%> |
-
+ <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
+
<%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%> |
+
<% end%>
From 4b923c540df6b0df1e082ba4a915752bd472f1ac Mon Sep 17 00:00:00 2001
From: huang
Date: Wed, 22 Jul 2015 16:38:52 +0800
Subject: [PATCH 13/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E7=89=88?=
=?UTF-8?q?=E6=9C=AC=E5=BA=93=E4=B8=A2=E5=A4=B1=E7=9A=84404=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/repositories_controller.rb | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index b335e1830..f5fa007a5 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -484,7 +484,18 @@ update
if params[:repository_id].present?
@repository = @project.repositories.find_by_identifier_param(params[:repository_id])
else
- @repository = @project.repository
+ # 多版本库,如果一个版本库为空则去下一个
+ rep_count = @project.repositories.count
+ if @project.repository.nil?
+ for i in 0..rep_count
+ unless @project.repositories[i].nil?
+ @repository = @project.repositories[i]
+ break
+ end
+ end
+ else
+ @repository = @project.repository
+ end
end
(render_404; return false) unless @repository
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
From 7d3a9adfcdea4d20241663fd320814442a05d7c3 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 17:00:41 +0800
Subject: [PATCH 14/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A8=8B?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=AF=AD=E8=A8=80=E4=B8=8D=E6=88=90=E5=8A=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 2 +-
.../homework_common/_homework_detail_programing_form.html.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index e71fd5e29..951abfdec 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -209,7 +209,7 @@ class HomeworkCommonController < ApplicationController
end
if @homework.homework_type == 2 && @homework_detail_programing #编程作业
- @homework_detail_programing.language = "C++"
+ @homework_detail_programing.language = params[:language]
@homework_detail_programing.standard_code = params[:standard_code]
@homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_tests = @homework.homework_tests
diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb
index 5d1d5ce88..be08dd107 100644
--- a/app/views/homework_common/_homework_detail_programing_form.html.erb
+++ b/app/views/homework_common/_homework_detail_programing_form.html.erb
@@ -56,7 +56,7 @@
-
- <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language), {:class => "fl mb10 h26 w70"} %>
+ <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %>
From ffee6d27a6b1f81a987ca685686b5a4c7ef334e1 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 17:16:28 +0800
Subject: [PATCH 15/16] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=BC=96=E7=A8=8B?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 44 +++++++++----------
app/views/homework_common/new.html.erb | 28 ++++--------
2 files changed, 31 insertions(+), 41 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 951abfdec..54963b0fd 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- # @homework_type = "1"
- #
- # @homework = HomeworkCommon.new
- # @homework.safe_attributes = params[:homework_common]
- # @homework.late_penalty = 0
- # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
- #
- # if @homework_type == "1"
- # #匿评作业相关属性
- # @homework_detail_manual = HomeworkDetailManual.new
- # @homework_detail_manual.ta_proportion = 0.6
- # @homework_detail_manual.absence_penalty = 0
- # @homework_detail_manual.evaluation_num = 3
- # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.homework_detail_manual = @homework_detail_manual
- # elsif @homework_type == "2"
- # #编程作业相关属性
- # @homework_detail_programing = HomeworkDetailPrograming.new
- # @homework.homework_detail_programing = @homework_detail_programing
- # end
+ @homework_type = "1"
+
+ @homework = HomeworkCommon.new
+ @homework.safe_attributes = params[:homework_common]
+ @homework.late_penalty = 0
+ @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+
+ if @homework_type == "1"
+ #匿评作业相关属性
+ @homework_detail_manual = HomeworkDetailManual.new
+ @homework_detail_manual.ta_proportion = 0.6
+ @homework_detail_manual.absence_penalty = 0
+ @homework_detail_manual.evaluation_num = 3
+ @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.homework_detail_manual = @homework_detail_manual
+ elsif @homework_type == "2"
+ #编程作业相关属性
+ @homework_detail_programing = HomeworkDetailPrograming.new
+ @homework.homework_detail_programing = @homework_detail_programing
+ end
respond_to do |format|
format.html
end
diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb
index cdc2ceca0..6fc0fff0e 100644
--- a/app/views/homework_common/new.html.erb
+++ b/app/views/homework_common/new.html.erb
@@ -1,27 +1,17 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
+<%= error_messages_for 'homework_common' %>
<%= l(:label_course_homework_new)%>
-
- <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
-
-
- 请选择将要发布的作业类型
-
-
-
- 人工评分的作业(支持匿名互评、灵活设置评分比例)
-
-
-
-
- 自动评测的编程作业(支持C/C++程序的自动评分)
-
-
-
- 下一步
-
+
+ <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
+ <%= hidden_field_tag "course",@course.id%>
+ <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
+
提交
+ <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
+ <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
From c1824a6db01d24ba120556bf1543fae7755f529a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 22 Jul 2015 17:47:48 +0800
Subject: [PATCH 16/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A8=8B?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8F=91=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 54963b0fd..333f86da1 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -236,6 +236,25 @@ class HomeworkCommonController < ApplicationController
end
end
end
+
+ #发送修改作业的请求
+ question = {title:@homework.name,content:@homework.description}
+ question[:input] = []
+ question[:output] = []
+ @homework.homework_tests.each do |test|
+ question[:input] << test.input
+ question[:output] << test.output
+ end
+ uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json")
+ body = question.to_json
+ res = Net::HTTP.new(uri.host, uri.port).start do |client|
+ request = Net::HTTP::Put.new(uri.path)
+ request.body = body
+ request["Content-Type"] = "application/json"
+ client.request(request)
+ end
+ result = JSON.parse(res.body)
+ homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
end
@homework.save_attachments(params[:attachments])