Merge branch 'develop' into szzh

This commit is contained in:
huang 2015-07-23 09:06:37 +08:00
commit fc8a81c46d
6 changed files with 41 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -47,8 +47,9 @@
<td class="td_tit">
<%= test.output%>
</td>
<td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td>
<input type="hidden" value="<%= test.student_work_test.result if test.student_work_test%>">
<% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
<td class="td_50 c_red"><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%></td>
<input type="hidden" value="<%= student_work_test.result if student_work_test%>">
</tr>
<% end%>

View File

@ -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

View File

@ -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|