增加匿评开启时间和匿评关闭时间,并对其业务逻辑进行js的控制。以及这两个值得修改
This commit is contained in:
parent
9f0eb937fe
commit
7a62b7f13d
|
@ -150,6 +150,10 @@ class HomeworkCommonController < ApplicationController
|
||||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||||
@homework.course_id = params[:course_id]
|
@homework.course_id = params[:course_id]
|
||||||
|
|
||||||
|
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||||
|
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
|
||||||
|
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
|
||||||
|
|
||||||
@homework.save_attachments(params[:attachments])
|
@homework.save_attachments(params[:attachments])
|
||||||
render_attachment_warning_if_needed(@homework)
|
render_attachment_warning_if_needed(@homework)
|
||||||
|
|
||||||
|
|
|
@ -468,8 +468,8 @@ class UsersController < ApplicationController
|
||||||
homework_detail_manual = HomeworkDetailManual.new
|
homework_detail_manual = HomeworkDetailManual.new
|
||||||
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
|
homework_detail_manual.ta_proportion = homework.homework_type == 1 ? 0.6 : 0.3
|
||||||
homework_detail_manual.comment_status = 1
|
homework_detail_manual.comment_status = 1
|
||||||
homework_detail_manual.evaluation_start = Time.now
|
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? homework.end_time + 7 : params[:evaluation_start]
|
||||||
homework_detail_manual.evaluation_end = Time.now
|
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
|
||||||
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
|
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
|
||||||
homework_detail_manual.absence_penalty = 5
|
homework_detail_manual.absence_penalty = 5
|
||||||
homework.homework_detail_manual = homework_detail_manual
|
homework.homework_detail_manual = homework_detail_manual
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
$('#ajax-modal').siblings().remove();
|
$('#ajax-modal').siblings().remove();
|
||||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
$('#ajax-modal').parent().css("top","30%").css("left","40%");
|
$('#ajax-modal').parent().css("top","65%").css("left","60%");
|
||||||
$('#ajax-modal').parent().addClass("anonymos_work");
|
$('#ajax-modal').parent().addClass("anonymos_work");
|
||||||
});
|
});
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
|
@ -21,6 +21,14 @@
|
||||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
||||||
<%= calendar_for('homework_end_time')%>
|
<%= calendar_for('homework_end_time')%>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="calendar_div fl ml10">
|
||||||
|
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_start%>" >
|
||||||
|
<%= calendar_for('evaluation_start_time')%>
|
||||||
|
</div>
|
||||||
|
<div class="calendar_div fl ml10">
|
||||||
|
<input type="text" name="evaluation_end" id="evaluation_end_time" placeholder="关闭匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_end%>" >
|
||||||
|
<%= calendar_for('evaluation_end_time')%>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<!-- 老师身份才可以发布作业 -->
|
<!-- 老师身份才可以发布作业 -->
|
||||||
<div class="HomeWork mb10">
|
<div class="HomeWork mb10">
|
||||||
<% homework = HomeworkCommon.new %>
|
<% homework = HomeworkCommon.new %>
|
||||||
|
<% homework.homework_detail_manual = HomeworkDetailManual.new%>
|
||||||
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
|
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
|
||||||
<div id="HomeWorkCon">
|
<div id="HomeWorkCon">
|
||||||
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
|
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
|
||||||
|
|
33
db/schema.rb
33
db/schema.rb
|
@ -497,23 +497,26 @@ ActiveRecord::Schema.define(:version => 20150918134804) do
|
||||||
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
||||||
add_index "documents", ["project_id"], :name => "documents_project_id"
|
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||||||
|
|
||||||
create_table "dts", :force => true do |t|
|
create_table "dts", :primary_key => "Num", :force => true do |t|
|
||||||
t.string "IPLineCode"
|
t.string "Defect", :limit => 50
|
||||||
t.string "Description"
|
t.string "Category", :limit => 50
|
||||||
t.string "Num"
|
|
||||||
t.string "Variable"
|
|
||||||
t.string "TraceInfo"
|
|
||||||
t.string "Method"
|
|
||||||
t.string "File"
|
t.string "File"
|
||||||
t.string "IPLine"
|
t.string "Method"
|
||||||
t.string "Review"
|
t.string "Module", :limit => 20
|
||||||
t.string "Category"
|
t.string "Variable", :limit => 50
|
||||||
t.string "Defect"
|
t.integer "StartLine"
|
||||||
t.string "PreConditions"
|
t.integer "IPLine"
|
||||||
t.string "StartLine"
|
t.string "IPLineCode", :limit => 200
|
||||||
|
t.string "Judge", :limit => 15
|
||||||
|
t.integer "Review", :limit => 1
|
||||||
|
t.string "Description"
|
||||||
|
t.text "PreConditions", :limit => 2147483647
|
||||||
|
t.text "TraceInfo", :limit => 2147483647
|
||||||
|
t.text "Code", :limit => 2147483647
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at"
|
||||||
|
t.integer "id", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "enabled_modules", :force => true do |t|
|
create_table "enabled_modules", :force => true do |t|
|
||||||
|
|
|
@ -56,18 +56,20 @@ function show_more_project(url){
|
||||||
}
|
}
|
||||||
|
|
||||||
//老师提交 新建/修改 作业
|
//老师提交 新建/修改 作业
|
||||||
function submit_homework(id)
|
function submit_homework(id){
|
||||||
{
|
if(!regex_homework_name()){
|
||||||
if(!regex_homework_name())
|
|
||||||
{
|
|
||||||
$("#homework_name").focus();
|
$("#homework_name").focus();
|
||||||
}
|
}
|
||||||
else if(!regex_homework_end_time())
|
else if(!regex_homework_end_time()){
|
||||||
{
|
|
||||||
$("#homework_end_time").focus();
|
$("#homework_end_time").focus();
|
||||||
}
|
}
|
||||||
else if(!regex_course_id())
|
else if(!regex_evaluation_start()){
|
||||||
{
|
$("#evaluation_start_time").focus()
|
||||||
|
}
|
||||||
|
else if(!regex_evaluation_end()){
|
||||||
|
$("#evaluation_end_time").focus()
|
||||||
|
}
|
||||||
|
else if(!regex_course_id()){
|
||||||
$("#course_id").focus();
|
$("#course_id").focus();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -134,6 +136,42 @@ function search_homework_by_name(url){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//验证匿评开启时间:大于截止时间,或者为空
|
||||||
|
function regex_evaluation_start(){
|
||||||
|
var evaluation_start = $.trim($("#evaluation_start_time").val());
|
||||||
|
if(evaluation_start == ""){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var end_time = new Date($.trim($("#homework_end_time").val()));
|
||||||
|
var evaluation_start_time = new Date(evaluation_start);
|
||||||
|
if(evaluation_start_time > end_time){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
$("#homework_end_time_span").text("开启匿评日期必须大于截止日期");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
|
||||||
|
function regex_evaluation_end(){
|
||||||
|
var evaluation_start = $.trim($("#evaluation_start_time").val());
|
||||||
|
var evaluation_end = $.trim($("#evaluation_end_time").val());
|
||||||
|
if(evaluation_end == ""){
|
||||||
|
return true;
|
||||||
|
}else if(evaluation_start == ""){
|
||||||
|
$("#homework_end_time_span").text("开启匿评日期为空时,关闭匿评日期必须为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var evaluation_start_time = new Date(evaluation_start);
|
||||||
|
var evaluation_end_time = new Date(evaluation_end);
|
||||||
|
if(evaluation_end_time > evaluation_start_time){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
$("#homework_end_time_span").text("关闭匿评日期必须大于开启匿评日期");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//提交新建作品
|
//提交新建作品
|
||||||
function new_student_work()
|
function new_student_work()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue