作业小齿轮中的“启用/禁用匿评”功能的完善
This commit is contained in:
parent
42ab249651
commit
42b22ddb83
|
@ -1317,29 +1317,43 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def forbidden_anonymous_comment
|
def forbidden_anonymous_comment
|
||||||
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
|
|
||||||
homework_detail_manual = @homework.homework_detail_manual
|
homework_detail_manual = @homework.homework_detail_manual
|
||||||
homework_detail_programing = @homework.homework_detail_programing
|
if homework_detail_manual.comment_status != 0
|
||||||
if @homework.anonymous_comment == 1
|
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
|
||||||
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
|
homework_detail_programing = @homework.homework_detail_programing
|
||||||
else
|
|
||||||
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
|
|
||||||
end
|
|
||||||
if @homework.homework_type == 2 && homework_detail_programing
|
|
||||||
if @homework.anonymous_comment == 1
|
if @homework.anonymous_comment == 1
|
||||||
homework_detail_programing.ta_proportion = 0.6
|
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
|
||||||
|
@status = 1
|
||||||
else
|
else
|
||||||
homework_detail_programing.ta_proportion = 0.5
|
if @homework.end_time < Time.now
|
||||||
|
homework_detail_manual.evaluation_start = (Time.now + 7*24*60*60).strftime("%Y-%m-%d")
|
||||||
|
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
|
||||||
|
@status = 2
|
||||||
|
else
|
||||||
|
homework_detail_manual.evaluation_start = (@homework.end_time + 7*24*60*60).strftime("%Y-%m-%d")
|
||||||
|
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
|
||||||
|
@status = 3
|
||||||
|
end
|
||||||
|
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
|
||||||
end
|
end
|
||||||
|
if @homework.homework_type == 2 && homework_detail_programing
|
||||||
|
if @homework.anonymous_comment == 1
|
||||||
|
homework_detail_programing.ta_proportion = 0.6
|
||||||
|
else
|
||||||
|
homework_detail_programing.ta_proportion = 0.5
|
||||||
|
end
|
||||||
|
end
|
||||||
|
homework_detail_manual.save
|
||||||
|
homework_detail_programing.save if homework_detail_programing
|
||||||
|
@homework.student_works.each do |student_work|
|
||||||
|
set_final_score @homework,student_work
|
||||||
|
student_work.save
|
||||||
|
end
|
||||||
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
|
@hw_status = params[:hw_status].to_i
|
||||||
|
else
|
||||||
|
@status = 0
|
||||||
end
|
end
|
||||||
homework_detail_manual.save
|
|
||||||
homework_detail_programing.save if homework_detail_programing
|
|
||||||
@homework.student_works.each do |student_work|
|
|
||||||
set_final_score @homework,student_work
|
|
||||||
student_work.save
|
|
||||||
end
|
|
||||||
@user_activity_id = params[:user_activity_id].to_i
|
|
||||||
@hw_status = params[:hw_status].to_i
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def revise_attachment
|
def revise_attachment
|
||||||
|
|
|
@ -4,11 +4,18 @@ sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||||
<% else %>
|
<% else %>
|
||||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @homework.anonymous_comment == 0 %>
|
var str = "";
|
||||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
<% case @status %>
|
||||||
'<div class="muban_popup_con ml30 mr30 mt20 mb10 clear"><p class="mb10 f14 text_c">将于7天后自动启动该作业的匿评</p><p class="mb10 f14 text_c">您可以在匿评设置中进行修改</p>' +
|
<% when 0 %>
|
||||||
'<a href="javascript:void(0);" class="btn btn-blue mt10" style="margin-left: 142px;" onclick="hideModal();">知道啦</a></div></div>';
|
str = "请于作业发布后再进行操作";
|
||||||
pop_box_new(htmlvalue, 400, 178);
|
<% when 1 %>
|
||||||
<% else %>
|
str = "作业已禁用匿评";
|
||||||
hideModal();
|
<% when 2 %>
|
||||||
<% end %>
|
str = "将于7天后自动启动该作业的匿评<br/>您可以在匿评设置中进行修改";
|
||||||
|
<% when 3 %>
|
||||||
|
str = "将于作业截止7天后自动启动该作业的匿评<br/>您可以在匿评设置中进行修改";
|
||||||
|
<% end %>
|
||||||
|
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||||
|
'<div class="muban_popup_con ml30 mr30 mt20 mb10 clear"><p class="mb10 f14 text_c">' + str + '</p>' +
|
||||||
|
'<a href="javascript:void(0);" class="btn btn-blue mt10" style="margin-left: 142px;" onclick="hideModal();">知道啦</a></div></div>';
|
||||||
|
pop_box_new(htmlvalue, 400, 178);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% if activity.anonymous_comment == 0%>
|
<% if activity.anonymous_comment == 0%>
|
||||||
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
|
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
|
||||||
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
|
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start.nil? ? '--' : (activity.homework_detail_manual.evaluation_start.to_s+" 00:00") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
|
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
|
||||||
</div>
|
</div>
|
||||||
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
|
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
|
||||||
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
|
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end.nil? ? '--' : (activity.homework_detail_manual.evaluation_end.to_s+" 00:00") %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,12 +111,12 @@
|
||||||
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
|
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
<% if activity.anonymous_comment == 0 && comment_status == 1 %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
|
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
|
||||||
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
||||||
</li>
|
</li>
|
||||||
<% elsif activity.anonymous_comment == 1 %>
|
<% elsif activity.anonymous_comment == 1 && comment_status > 0 %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to("启用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
|
<%= link_to("启用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
|
||||||
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
||||||
|
|
Loading…
Reference in New Issue