作业编辑
This commit is contained in:
parent
9002844188
commit
e4efc8c302
|
@ -86,7 +86,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
@homework.homework_type = params[:homework_type].to_i || @homework.homework_type
|
||||
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0
|
||||
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||
if anonymous != @homework.anonymous_comment
|
||||
if anonymous == 1
|
||||
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 1.0 : 0.4
|
||||
|
@ -112,7 +112,7 @@ class HomeworkCommonController < ApplicationController
|
|||
if @homework.homework_type == 2
|
||||
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_programing.language = params[:language_type].to_i
|
||||
@homework_detail_programing.language = params[:language_type].to_i if params[:language_type]
|
||||
if anonymous != @homework.anonymous_comment
|
||||
if anonymous == 1
|
||||
@homework_detail_programing.ta_proportion = 0.6
|
||||
|
@ -121,8 +121,8 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
@homework.homework_tests.delete_all
|
||||
inputs = params[:program][:input]
|
||||
@homework.homework_tests.delete_all if params[:program]
|
||||
inputs = params[:program][:input] if params[:program]
|
||||
if Array === inputs
|
||||
inputs.each_with_index do |val, i|
|
||||
@homework.homework_tests << HomeworkTest.new(
|
||||
|
@ -137,12 +137,12 @@ class HomeworkCommonController < ApplicationController
|
|||
if @homework.homework_type == 3
|
||||
@homework.homework_detail_group ||= HomeworkDetailGroup.new
|
||||
@homework_detail_group = @homework.homework_detail_group
|
||||
@homework_detail_group.min_num = params[:min_num].to_i
|
||||
@homework_detail_group.max_num = params[:max_num].to_i
|
||||
@homework_detail_group.base_on_project = params[:base_on_project].to_i
|
||||
@homework_detail_group.min_num = params[:min_num].to_i if params[:min_num]
|
||||
@homework_detail_group.max_num = params[:max_num].to_i if params[:max_num]
|
||||
@homework_detail_group.base_on_project = params[:base_on_project].to_i if params[:base_on_project]
|
||||
end
|
||||
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||
if @homework.save
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
@homework_detail_programing.save if @homework_detail_programing
|
||||
|
|
|
@ -192,18 +192,6 @@ module CoursesHelper
|
|||
# garble count
|
||||
# end
|
||||
|
||||
def homework_type_option
|
||||
type = []
|
||||
option1 = []
|
||||
option2 = []
|
||||
option1 << l(:label_task_submit_form_accessory)
|
||||
option1 << 1
|
||||
option2 << l(:label_task_submit_form_project)
|
||||
option2 << 2
|
||||
type << option1
|
||||
type << option2
|
||||
end
|
||||
|
||||
def proportion_option
|
||||
type = []
|
||||
i = 0
|
||||
|
|
|
@ -225,19 +225,6 @@ module ProjectsHelper
|
|||
Project.tagged_with(tag_name).order('updated_on desc')
|
||||
end
|
||||
|
||||
# added by fq
|
||||
def homework_type_option
|
||||
type = []
|
||||
option1 = []
|
||||
option2 = []
|
||||
option1 << l(:label_task_submit_form_accessory)
|
||||
option1 << 1
|
||||
option2 << l(:label_task_submit_form_project)
|
||||
option2 << 2
|
||||
type << option1
|
||||
type << option2
|
||||
end
|
||||
|
||||
#是否启动互评下拉框
|
||||
def is_evaluation_option
|
||||
type = []
|
||||
|
|
|
@ -191,6 +191,9 @@
|
|||
<select class="homework-type-option fl mr10" name="homework_type" <%=(not_allow_select || group_pro) ? 'disabled' : '' %> id="homework_type_option">
|
||||
<%= options_for_select(homework_type_option,homework.homework_type) %>
|
||||
</select>
|
||||
<% if not_allow_select || group_pro %>
|
||||
<input type="text" style="display: none" name="homework_type" value="<%=homework.homework_type %>"/>
|
||||
<% end %>
|
||||
<label class="fl c_grey f14 mt5">截止日期:</label>
|
||||
<div class="calendar_div fl mr10">
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
|
|
Loading…
Reference in New Issue