作业小齿轮中的“启用/禁用匿评”功能的完善

This commit is contained in:
cxt 2017-03-09 15:45:08 +08:00
parent 42ab249651
commit 42b22ddb83
3 changed files with 51 additions and 30 deletions

View File

@ -1317,12 +1317,23 @@ class StudentWorkController < ApplicationController
end
def forbidden_anonymous_comment
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
homework_detail_manual = @homework.homework_detail_manual
if homework_detail_manual.comment_status != 0
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
homework_detail_programing = @homework.homework_detail_programing
if @homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
@status = 1
else
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
if @homework.homework_type == 2 && homework_detail_programing
@ -1340,6 +1351,9 @@ class StudentWorkController < ApplicationController
end
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
else
@status = 0
end
end
def revise_attachment

View File

@ -4,11 +4,18 @@ sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% if @homework.anonymous_comment == 0 %>
var str = "";
<% case @status %>
<% when 0 %>
str = "请于作业发布后再进行操作";
<% when 1 %>
str = "作业已禁用匿评";
<% when 2 %>
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">将于7天后自动启动该作业的匿评</p><p class="mb10 f14 text_c">您可以在匿评设置中进行修改</p>' +
'<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);
<% else %>
hideModal();
<% end %>

View File

@ -4,7 +4,7 @@
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start.nil? ? '--' : (activity.homework_detail_manual.evaluation_start.to_s+" 00:00") %>
</div>
<% end %>
</div>
@ -15,7 +15,7 @@
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end.nil? ? '--' : (activity.homework_detail_manual.evaluation_end.to_s+" 00:00") %>
</div>
<% end %>
</div>
@ -111,12 +111,12 @@
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<% if activity.anonymous_comment == 0 && comment_status == 1 %>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% elsif activity.anonymous_comment == 1 %>
<% elsif activity.anonymous_comment == 1 && comment_status > 0 %>
<li>
<%= link_to("启用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>