启动匿评、关闭匿评的提示

This commit is contained in:
cxt 2016-11-02 16:46:47 +08:00
parent 54f45f18a5
commit ecae600546
9 changed files with 73 additions and 99 deletions

View File

@ -202,24 +202,24 @@ class HomeworkCommonController < ApplicationController
if @homework_detail_manual.comment_status == 1 if @homework_detail_manual.comment_status == 1
student_works = @homework.student_works.has_committed student_works = @homework.student_works.has_committed
if student_works && student_works.size >= 2 if student_works && student_works.size >= 2
# if @homework.homework_type == 3 if @homework.homework_type == 3
# student_work_projects = @homework.student_work_projects.where("student_work_id is not null") student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
# student_work_projects.each_with_index do |pro_work, pro_index| student_work_projects.each_with_index do |pro_work, pro_index|
# n = @homework_detail_manual.evaluation_num n = @homework_detail_manual.evaluation_num
# n = n < student_works.size ? n : student_works.size - 1 n = n < student_works.size ? n : student_works.size - 1
# work_index = -1 work_index = -1
# student_works.each_with_index do |stu_work, stu_index| student_works.each_with_index do |stu_work, stu_index|
# if stu_work.id.to_i == pro_work.student_work_id.to_i if stu_work.id.to_i == pro_work.student_work_id.to_i
# work_index = stu_index work_index = stu_index
# end end
# end end
# assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
# assigned_homeworks.each do |h| assigned_homeworks.each do |h|
# student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
# student_works_evaluation_distributions.save student_works_evaluation_distributions.save
# end end
# end end
# else else
student_works.each_with_index do |work, index| student_works.each_with_index do |work, index|
user = work.user user = work.user
n = @homework_detail_manual.evaluation_num n = @homework_detail_manual.evaluation_num
@ -230,7 +230,7 @@ class HomeworkCommonController < ApplicationController
student_works_evaluation_distributions.save student_works_evaluation_distributions.save
end end
end end
#end end
@homework_detail_manual.update_column('comment_status', 2) @homework_detail_manual.update_column('comment_status', 2)
@homework_detail_manual.update_column('evaluation_start', Date.today) @homework_detail_manual.update_column('evaluation_start', Date.today)
@statue = 1 @statue = 1
@ -300,13 +300,15 @@ class HomeworkCommonController < ApplicationController
def alert_anonymous_comment def alert_anonymous_comment
@cur_size = 0 @cur_size = 0
@totle_size = 0 @totle_size = 0
@work_size = 0
if @homework_detail_manual.comment_status == 1 if @homework_detail_manual.comment_status == 1
@totle_size = @course.student.count @totle_size = @course.student.count
@cur_size = @homework.student_works.has_committed.size @cur_size = @homework.student_works.where("work_status != 0").size
@work_size = @homework.student_works.has_committed.size
elsif @homework_detail_manual.comment_status == 2 elsif @homework_detail_manual.comment_status == 2
@homework.student_works.has_committed.map { |work| @totle_size += work.student_works_evaluation_distributions.count} @homework.student_works.where("work_status != 0").map { |work| @totle_size += work.student_works_evaluation_distributions.count}
@cur_size = 0 @cur_size = 0
@homework.student_works.has_committed.map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count} @homework.student_works.where("work_status != 0").map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count}
end end
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
@user_activity_id = params[:user_activity_id].to_i @user_activity_id = params[:user_activity_id].to_i

View File

@ -1,44 +1,24 @@
<div id="popbox02"> <div id="muban_popup_box" style="width:550px;">
<div class="ni_con"> <div class="muban_popup_top">
<h3 class="fl">
<% if @homework_detail_manual.comment_status == 1%>
启动匿评提示
<% elsif @homework_detail_manual.comment_status == 2 %>
关闭匿评提示
<% end %>
</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con ml30 mr30 mt20 mb10 clear" >
<% if @homework_detail_manual.comment_status == 1%> <% if @homework_detail_manual.comment_status == 1%>
<h2>开启匿评功能</h2> <p class="mb10">开启匿评之后提交作品的学生及其作品,不能参与匿评,匿评评分将被记为 <span class="c_red">0</span> 分。</p>
<p> <p class="mb10">本次作业共<span class="c_red"> <%= @totle_size %>个 </span>学生,已有 <span class="c_red"><%= @cur_size %>个</span> 学生共提交了 <span class="c_red"><%= @work_size %></span> 份作品,占 <span class="c_red"><%= @percent %>%</span>,是否确定开启匿评?</p>
开启匿评后提交的作品将 <% elsif @homework_detail_manual.comment_status == 2 %>
<span class="c_blue">不能参与匿评</span> <p class="mb10">关闭匿评后学生将不能对作品进行匿评,且作品列表将会公开,</p>
匿评评分将被记为 <p class="mb10">目前分配了<span class="c_red"> <%= @totle_size %>份 </span>匿评作品,已评了 <span class="c_red"><%= @cur_size %>份</span> 作品,占 <span class="c_red"><%= @percent %>%</span>,是否确定关闭匿评?</p>
<span class="c_pink">0分</span>
。目前有
<span class="c_pink"><%= @totle_size%>个</span>
学生,共提交了
<span class="c_pink"><%= @cur_size %></span>
份作品,占
<span class="c_pink"><%= @percent %>%</span>
是否确定开启匿评?
</p>
<% elsif @homework_detail_manual.comment_status == 2 %>
<h2>关闭匿评功能</h2>
<p>
关闭匿评后学生将不能对作品进行
<span class="c_blue">匿评</span>
,且作品列表将会
<span class="c_blue">公开</span>
目前分配了
<span class="c_pink"><%= @totle_size%>份</span>
匿评作品,已评了
<span class="c_pink"><%= @cur_size %></span>
份作品,占
<span class="c_pink"><%= @percent %>%</span>
是否确定关闭匿评?
</p>
<% end %> <% end %>
<div class="ni_btn"> <a href="javascript:void(0);" class="fl sy_btn_blue mr5 ml160" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@hw_status%>');">确定</a>
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@hw_status%>');" style="margin-bottom: 20px;" > <a href="javascript:void(0);" class="fl sy_btn_grey" onclick="hideModal();">取消</a>
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
取&nbsp;&nbsp;消
</a>
</div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,2 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>'); var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/alert_anonyoms') %>";
showModal('ajax-modal', '500px'); pop_box_new(htmlvalue, 550, 171);
$('#ajax-modal').siblings().remove();
$('#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>");
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");

View File

@ -1,12 +1,6 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>"; var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>";
pop_box_new(htmlvalue, 620, 315); pop_box_new(htmlvalue, 550, 315);
//$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>');
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
//showModal('ajax-modal', '350px');
//$('#ajax-modal').siblings().remove();
//$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
//"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
//$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed").css("border","3px solid #269ac9");
$(function() { $('#evaluation_start_time').datepicker(datepickerOptions); $(function() { $('#evaluation_start_time').datepicker(datepickerOptions);
$('#evaluation_end_time').datepicker(datepickerOptions); $('#evaluation_end_time').datepicker(datepickerOptions);
}); });

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%> <%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>

View File

@ -13,8 +13,10 @@
<%=form_tag(add_group_member_student_work_index_path(:homework => homework.id), :method => :post, :id => 'add_group_member_form') do %> <%=form_tag(add_group_member_student_work_index_path(:homework => homework.id), :method => :post, :id => 'add_group_member_form') do %>
<% str = User.current.id.to_s%> <% str = User.current.id.to_s%>
<% student_work = StudentWork.where("homework_common_id = #{homework.id} and user_id = #{User.current.id}").first %> <% student_work = StudentWork.where("homework_common_id = #{homework.id} and user_id = #{User.current.id}").first %>
<% student_work.student_work_projects.where("is_leader = ?", 0).each do |pro| %> <% if student_work %>
<% str += ','+pro.user_id.to_s %> <% student_work.student_work_projects.where("is_leader = ?", 0).each do |pro| %>
<% str += ','+pro.user_id.to_s %>
<% end %>
<% end %> <% end %>
<!--<span class="none" id="group_member_ids"><%#=str %></span>--> <!--<span class="none" id="group_member_ids"><%#=str %></span>-->
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %> <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>

View File

@ -16,24 +16,24 @@ namespace :homework_evaluation do
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评 if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
student_works = homework_common.student_works.has_committed student_works = homework_common.student_works.has_committed
if student_works && student_works.size >= 2 if student_works && student_works.size >= 2
# if homework_common.homework_type == 3 if homework_common.homework_type == 3
# student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") student_work_projects = homework_common.student_work_projects.where("student_work_id is not null")
# student_work_projects.each_with_index do |pro_work, pro_index| student_work_projects.each_with_index do |pro_work, pro_index|
# n = homework_detail_manual.evaluation_num n = homework_detail_manual.evaluation_num
# n = n < student_works.size ? n : student_works.size - 1 n = n < student_works.size ? n : student_works.size - 1
# work_index = -1 work_index = -1
# student_works.each_with_index do |stu_work, stu_index| student_works.each_with_index do |stu_work, stu_index|
# if stu_work.id.to_i == pro_work.student_work_id.to_i if stu_work.id.to_i == pro_work.student_work_id.to_i
# work_index = stu_index work_index = stu_index
# end end
# end end
# assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
# assigned_homeworks.each do |h| assigned_homeworks.each do |h|
# student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
# student_works_evaluation_distributions.save student_works_evaluation_distributions.save
# end end
# end end
# else else
student_works.each_with_index do |work, index| student_works.each_with_index do |work, index|
user = work.user user = work.user
n = homework_detail_manual.evaluation_num n = homework_detail_manual.evaluation_num
@ -44,7 +44,7 @@ namespace :homework_evaluation do
student_works_evaluation_distributions.save student_works_evaluation_distributions.save
end end
end end
#end end
homework_detail_manual.update_column('comment_status', 2) homework_detail_manual.update_column('comment_status', 2)
# 匿评开启消息邮件通知,# 所有人 # 匿评开启消息邮件通知,# 所有人
#send_message_anonymous_comment(homework_common, 2) #send_message_anonymous_comment(homework_common, 2)

View File

@ -268,7 +268,7 @@ function submit_set_evaluation_attr(end_time){
$("#evaluation_num").focus(); $("#evaluation_num").focus();
} }
else{ else{
$('#popbox02 form').submit(); $('#muban_popup_box form').submit();
} }
} }

View File

@ -50,7 +50,7 @@ function reset_topic(){
$("#evaluation_num").focus(); $("#evaluation_num").focus();
} }
else{ else{
$('#popbox02 form').submit(); $('#muban_popup_box form').submit();
hideModal(); hideModal();
} }
} }