Merge branch 'cxt_course' into 'develop'

班级作业增加设置选项:成绩公开范围



See merge request !37
This commit is contained in:
黄井泉 2016-12-02 14:53:55 +08:00
commit 42775a82f9
37 changed files with 348 additions and 189 deletions

View File

@ -6,7 +6,7 @@ class HomeworkCommonController < ApplicationController
include StudentWorkHelper
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,:set_score_open,:alert_score_open_modal]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
before_filter :member_of_course, :only => [:index]
@ -198,6 +198,23 @@ class HomeworkCommonController < ApplicationController
end
end
# 成绩公开范围弹框
def alert_score_open_modal
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
else
@user_activity_id = -1
end
@hw_status = params[:hw_status].to_i
end
def set_score_open
@homework.update_attribute('score_open', params[:score_open].to_i)
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
end
#开启匿评
#statue 1:启动成功2启动失败作业总数大于等于2份时才能启动匿评3:已开启匿评,请务重复开启,4:没有开启匿评的权限
def start_anonymous_comment
@ -257,26 +274,25 @@ class HomeworkCommonController < ApplicationController
def stop_anonymous_comment
@homework_detail_manual.update_column('comment_status', 3)
@homework_detail_manual.update_column('evaluation_end', Date.today)
#计算缺评扣分
# 计算缺评扣分
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
if @homework.homework_type != 3
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = @homework.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
st_work.save
# 参与匿评的缺评计算
@homework.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
# 未参与匿评的缺评计算
if @homework_detail_manual.no_anon_penalty == 0
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
@homework.student_works.where("work_status != 0").each do |student_work|
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count == 0
student_work.absence_penalty = @homework_detail_manual.absence_penalty * anon_count
student_work.save
end
end
end

View File

@ -270,6 +270,7 @@ class PollController < ApplicationController
#发布问卷
def publish_poll
@index = params[:index]
@poll.polls_status = 2
@poll.published_at = Time.now
@poll.show_result = params[:show_result].to_i if params[:show_result]
@ -508,6 +509,7 @@ class PollController < ApplicationController
#重新发布问卷
def republish_poll
@index = params[:index]
@poll.poll_questions.each do |poll_question|
poll_question.poll_votes.destroy_all
end
@ -530,6 +532,7 @@ class PollController < ApplicationController
#关闭问卷
def close_poll
@index = params[:index]
@poll.polls_status = 3
@poll.closed_at = Time.now
if @poll.save

View File

@ -982,33 +982,38 @@ class StudentWorkController < ApplicationController
end
end
if params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s
homework_detail_manual.absence_penalty = params[:absence_penalty]
no_anon_penalty = params[:no_anon_penalty] ? 1 : 0
if no_anon_penalty != homework_detail_manual.no_anon_penalty
homework_detail_manual.no_anon_penalty = no_anon_penalty
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
if @homework.homework_type != 3
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
else
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = @homework.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
st_work.save
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
@homework.student_works.where("work_status != 0").each do |student_work|
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count == 0
if no_anon_penalty == 0
student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count
else
student_work.absence_penalty = 0
end
student_work.save
end
end
end
homework_detail_manual.save if homework_detail_manual
end
if (params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s)
homework_detail_manual.absence_penalty = params[:absence_penalty]
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
@homework.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
end
homework_detail_manual.save if homework_detail_manual
end

View File

@ -2855,18 +2855,18 @@ module ApplicationHelper
#获取匿评相关连接代码
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'wpostOptionLink'
when 2
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'wpostOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
else
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
end
link
end

View File

@ -1,7 +1,7 @@
#手动评分作业表
#comment_status: 1:未开启匿评2开启匿评3匿评结束
class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty
belongs_to :homework_common
end

View File

@ -36,7 +36,7 @@
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
<% if @is_teacher && exercise.exercise_status > 1 %>
<% if exercise.exercise_status > 1 %>
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
<% end %>

View File

@ -0,0 +1,42 @@
<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 class="cl"></div>
</div>
<%= form_for('new_form',:url =>{:controller => 'homework_common',:action => 'set_score_open',:id => @homework.id,:user_activity_id => @user_activity_id, :hw_status => @hw_status},
:method => "post", :remote => true) do |f|%>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20">
<ul class="pro_newsetting_con fl">
<li class="mb10 clear">
<ul class="fl">
<li class="clear">
<label class="fl ml5">请选择作品成绩的公开范围</label>
</li>
<li class="clear ml20">
<input type="radio" class="fl" id="open_to_all" <%= @homework.score_open == 1 ? "checked" : "" %> value="1" name="score_open"/>
<label for="open_to_all" class="fl ml5 fontGrey2">成绩对所有学生可见</label>
</li>
<li class="clear ml20">
<input type="radio" class="fl" id="open_to_me" <%= @homework.score_open == 0 ? "checked" : "" %> value="0" name="score_open"/>
<label for="open_to_me" class="fl ml5 fontGrey2">成绩仅对自己可见</label>
</li>
</ul>
</li>
</ul>
<ul class="fl ml20">
<div class="popup_tip_box fontGrey2">
<em></em>
<span></span>
<p>老师和助教始终能看到所有成绩</p>
</div>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr20" onclick="$(this).parent().parent().parent().submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
</div>
<% end%>
</div>

View File

@ -17,6 +17,10 @@
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
</li>
<li class="mb10 clear">
<input type="checkbox" class="fl ml100" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 1 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
<label class="pop_box_label fl ml10" style="text-align: left">不参加匿评扣分</label>
</li>
<li class="mb10 clear mt30">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
</li>
@ -38,7 +42,7 @@
</ul>
</li>
</ul>
<ul class="fl mt5 ml20" >
<ul class="fl ml20">
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>
@ -49,6 +53,11 @@
<span></span>
<p >请输入数值0-50</p>
</div>
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>
<p>匿评开启后提交的作品,未能参加<br/>匿评,按照全部缺评扣分</p>
</div>
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>

View File

@ -23,7 +23,7 @@
<label for="other_score" class="fl ml5">助教评分</label>
</li>
</ul>
<ul class="fl mt5 ml20" >
<ul class="fl ml20" >
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>

View File

@ -17,6 +17,10 @@
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="fl w180" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
</li>
<li class="mb10 clear">
<input type="checkbox" class="fl ml100" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 1 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
<label class="pop_box_label fl ml10" style="text-align: left">不参加匿评扣分</label>
</li>
<li class="mb10 clear mt30">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
</li>
@ -42,7 +46,7 @@
</ul>
</li>
</ul>
<ul class="fl ml20 mt5">
<ul class="fl ml20">
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>
@ -53,6 +57,11 @@
<span></span>
<p id="absence_penalty_notice" class="">请输入数值0-50</p>
</div>
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>
<p>匿评开启后提交的作品,未能参加<br/>匿评,按照全部缺评扣分</p>
</div>
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>

View File

@ -34,7 +34,7 @@
</ul>
</li>
</ul>
<ul class="fl ml20 mt5">
<ul class="fl ml20">
<div class="popup_tip_box fontGrey2 mb10">
<em></em>
<span></span>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/alert_score_open_modal') %>";
pop_box_new(htmlvalue, 400, 200);

View File

@ -0,0 +1,11 @@
hideModal();
<% if @hw_status != 5 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% else %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% end %>

View File

@ -1,68 +1,93 @@
<% has_commit = has_commit_poll?(poll.id ,User.current)%>
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<% if @is_teacher%>
<li title="<%= poll.polls_name %>">
<div style="width: 310px;float: left;">
<% if has_commit %>
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<% else %>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<% end %>
<div>
<div title="<%= poll_name %>">
<div style="width: 600px;float: left;">
<% if has_commit %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% else %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% end %>
<% if poll.polls_status == 1 %>
<span class="exercise_status_nop fl mt3"></span>
<% elsif poll.polls_status == 2 %>
<span class="exercise_status_pub fl mt3"></span>
<% else %>
<span class="exercise_status_end fl mt3"></span>
<% end%>
</div>
</div>
<div id="exercise_opr_<%=poll.id %>" class="none fr">
<a href="javascript:void(0)" onClick="delete_exercise(<%=poll.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
<% if poll.polls_status == 1 %>
<%= link_to '', edit_poll_path(poll.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
<% end%>
</div>
</div>
</li>
<div class="cl"></div>
<% if poll.polls_status == 1%>
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%></li>
<% end%>
<div class="mt10">
<span class="c_grey fl mr15">创建时间:<%= format_time(poll.created_at) %></span>
<% if poll.polls_status > 1 %>
<span class="c_grey fl mr15">发布时间:<%= poll.published_at.nil? ? '未设置' : format_time(poll.published_at) %></span>
<% end %>
<% if poll.polls_status > 1 %>
<span class="c_grey fl mr15">答题:<span class="c_blue" title="已答学生数/未答学生数"><%= poll.poll_users.count %> / <%=@course.student.count %></span></span>
<% end %>
<% if poll.polls_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>);">发布问卷</a></li>
<% elsif poll.polls_status == 2%>
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_poll(<%= poll.id%>);">取消发布</a></li>
<% else%>
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布问卷</li>
<% end%>
<% if poll.polls_status == 1 %>
<div><a href="javascript:" class="pollsbtn btn_pu fr ml10" onclick="poll_submit(<%= poll.id%>,<%= poll.polls_name.length %>,<%= index%>);">发布问卷</a></div>
<% elsif poll.polls_status == 2%>
<div><a href="javascript:" class="pollsbtn btn_de fr ml10" onclick="republish_poll(<%= poll.id%>, <%=index %>);">取消发布</a></div>
<% else%>
<div class="pollsbtn fr ml10 pollsbtn_grey ml10">发布问卷</div>
<% end%>
<%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
<% if poll.polls_status == 1%>
<div class="pollsbtn fr ml10 pollsbtn_grey">统计结果</div>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<div><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr ml10"%></div>
<% end%>
<% if poll.polls_status == 1 %>
<li><%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%></li>
<% else%>
<li class="polls_de_grey fr ml5" title="未发布的问卷才能进行编辑">编辑</li>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="pollsbtn fr ml10" onclick="close_poll(<%= poll.id%>, <%=index %>);" href="javascript:">关闭</a></li>
<% else %>
<li class="pollsbtn fr ml10 pollsbtn_grey" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="polls_de fr ml5" onclick="close_poll(<%= poll.id%>);" href="javascript:">关闭</a></li>
<% else %>
<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<% if poll.polls_status == 1%>
<li class="polls_de_grey fr ml5">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%></li>
<% end%>
<li class="polls_date fr"><%= format_date poll.created_at.to_date%></li>
<% if poll.polls_status == 1%>
<li class="pollsbtn fr ml10 pollsbtn_grey">导出</li>
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li><%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "pollsbtn fr ml10"%></li>
<% end%>
<div class="clear"></div>
</div>
<% else%>
<% if poll.polls_status == 2%>
<% if has_commit%>
<li><%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
<li class="pollsbtn_tip fl ml5">已答</li>
<%else%>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue"%>
<%end%>
<div>
<% if has_commit%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_com fl ml5"></span>
<%else%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_nocom fl ml5"></span>
<%end%>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">发布时间:<%= format_time(poll.published_at) %></span>
<span class="c_grey fl mr15">答题:<span class="c_blue" title="已答学生数/未答学生数"><%= poll.poll_users.count %> / <%=@course.student.count %></span></span>
<% if poll.show_result == 1 %>
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr"%></li>
<%else%>
<li class="pollsbtn fr pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
<%end%>
<% end %>
<div class="clear"></div>
</div>
<% end%>
<li class="polls_date fr mr10"><%= format_date poll.created_at.to_date%></li>
<% if poll.show_result == 1 %>
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%></li>
<%else%>
<li class="pollsbtn fr mr10 pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
<%end%>
<% end %>
<% end%>

View File

@ -1,4 +1,4 @@
<div class="polls_head">
<div class="polls_head" style="width:730px;">
<h2>所有问卷
<span><%= @obj_count%></span>
</h2>

View File

@ -1,6 +1,6 @@
<% polls.each do |poll|%>
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
<% polls.each_with_index do |poll, i|%>
<ul id="polls_<%= poll.id %>" class="exercise_list_div" onmouseover="$('#exercise_opr_<%=poll.id %>').show();" onmouseout="$('#exercise_opr_<%=poll.id %>').hide();">
<%= render :partial => 'poll', :locals => {:poll => poll, :index => i} %>
</ul>
<div class="cl"></div>
<% end%>

View File

@ -1,2 +1,2 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>");
alert("关闭成功");

View File

@ -1 +1,2 @@
hideModal();
$("#polls").html("<%= escape_javascript(render :partial => 'poll_list') %>");

View File

@ -1,13 +1,13 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript">
function republish_poll(poll_id)
function republish_poll(poll_id, index)
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/republish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a href='/poll/"+ poll_id +"/republish_poll?index=" + index +"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
@ -26,7 +26,7 @@
function clickCanel(){hideModal("#popbox02");}
function poll_submit(poll_id,poll_name)
function poll_submit(poll_id,poll_name,index)
{
if(poll_name == 0)
{
@ -39,7 +39,7 @@
"<div class='upload_box'>" +
"<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/publish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a href='/poll/"+ poll_id +"/publish_poll?index=" + index + "' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
@ -57,14 +57,14 @@
}
}
function close_poll(poll_id)
function close_poll(poll_id, index)
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>问卷关闭后学生将不能继续提交问卷,<br />是否确定关闭该问卷?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/poll/"+ poll_id +"/close_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a href='/poll/"+ poll_id +"/close_poll?index=" + index +"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
@ -81,13 +81,20 @@
$('#ajax-modal').parent().addClass("popbox_polls");
}
function delete_exercise(id){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您是否确定删除</p><div class="cl"></div><a href="/poll/'+ id +'" class="fr sy_btn_blue mr90 mt10" data-method="delete" data-remote="true">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
</script>
<div class="courseRSide fl">
<div class="polls_content02" id="polls">
<div id="polls">
<%= render :partial => 'poll_list'%>
</div><!--问卷内容end-->
</div>

View File

@ -1,4 +1,4 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','111px');

View File

@ -1,4 +1,4 @@
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','80px');

View File

@ -30,7 +30,8 @@
</th>
</tr>
<% @stundet_works.each_with_index do |student_work, i|%>
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work, :index => i}%>
<% score_open = @homework.score_open == 1 || student_work.user == User.current %>
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open}%>
<tr>
<td colspan="12">
<div id="about_hwork_<%= student_work.id%>" class="about_hwork">

View File

@ -21,19 +21,29 @@
</span>
<% end %>
<div class="flex-container fl" style="width:340px;">
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teacher_score%>"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teaching_asistant_score%>"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
<div class="flex-cell student_work_<%= st.id%>">
<span class="<%= score_color (!score_open || st.teacher_score.nil? ? nil : st.teacher_score) %>">
<%= !score_open || st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%>
</span>
</div>
<div class="flex-cell student_work_<%= st.id%>">
<span class="<%= score_color (!score_open || st.teaching_asistant_score.nil? ? nil : st.teaching_asistant_score) %>">
<%= !score_open || st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%>
</span>
</div>
<% if @homework.anonymous_comment == 0 %>
<div class="flex-cell student_work_<%= st.id%>">
<div class="<%= score_color st.student_score%> student_score_info pr">
<% if st.student_score.nil? %>
<div class="<%= score_color (!score_open || st.student_score.nil? ? nil : st.student_score)%> student_score_info pr">
<% if !score_open || st.student_score.nil? %>
<% pro = @homework.student_work_projects.where("user_id = #{st.user_id}").first
if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil?
work = st
else
work = StudentWork.find pro.student_work_id
end %>
<% if @homework.homework_detail_manual.comment_status < 2 %>
<% if !score_open %>
<span title="">--</span>
<% elsif @homework.homework_detail_manual.comment_status < 2 %>
<span title="尚未开启匿评">未参与</span>
<% elsif @homework.homework_detail_manual.comment_status == 2 && work.student_works_evaluation_distributions.count != 0 %>
<span title="匿评期间,尚未获得他人匿评">待匿评</span>
@ -44,11 +54,9 @@
<% end %>
<% else %>
<%= format("%.1f", st.student_score) %>
<% end %>
<% unless st.student_score.nil? %>
<span class="linkBlue">
(<%= anon_count %>)
</span>
<span class="linkBlue">
(<%= anon_count %>)
</span>
<div class="g_infoNi none">
现共有
<span class="c_red">&nbsp;<%= anon_count %>&nbsp;</span>
@ -61,9 +69,9 @@
<% end %>
<div class="flex-cell">
<% score = st.work_score %>
<div class="<%= score_color score%> student_final_scor_info pr" style="display: inline">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="<%= score_color (!score_open || score.nil? ? nil : score)%> student_final_scor_info pr" style="display: inline">
<%= !score_open || score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless !score_open || score.nil?%>
<div class="score-tip none tl" style="line-height: 18px; top:-32px; right:-273px;">
<em></em>
<font></font>

View File

@ -75,7 +75,8 @@
</tr>
<%# end %>
<% @stundet_works.each_with_index do |student_work, i| %>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i} %>
<% score_open = @is_teacher || @homework.score_open == 1 || student_work.user == User.current %>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open} %>
<tr>
<td colspan="12">
<div id="about_hwork_<%= student_work.id %>" class="about_hwork">

View File

@ -52,24 +52,26 @@
<%=get_status student_work.work_status %>
<% end %>
</td>
<td class="hworkList70 <%= score_color student_work.teacher_score%>">
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
<td class="hworkList70 <%= score_color (!score_open || student_work.teacher_score.nil? ? nil : student_work.teacher_score)%>">
<%= !score_open || student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
</td>
<td class="hworkList70 <%= score_color student_work.teaching_asistant_score%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
<td class="hworkList70 <%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%>">
<%= !score_open || student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
</td>
<% if @homework.homework_type == 2%>
<!-- 系统评分 -->
<td class="hworkList70 <%= score_color student_work.system_score%>">
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
<td class="hworkList70 <%= score_color (!score_open || student_work.system_score.nil? ? nil : student_work.system_score)%>">
<%= !score_open || student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
</td>
<% end%>
<% if @homework.anonymous_comment == 0%>
<td class="hworkList70 <%= score_color student_work.student_score%> student_score_info pr">
<% if student_work.student_score.nil? %>
<% if student_work.work_status != 0 %>
<td class="hworkList70 <%= score_color (!score_open || student_work.student_score.nil? ? nil : student_work.student_score)%> student_score_info pr">
<% if !score_open || student_work.student_score.nil? %>
<% if !score_open %>
<span title="">--</span>
<% elsif student_work.work_status != 0 %>
<% if @homework.homework_detail_manual.comment_status < 2 %>
<span title="尚未开启匿评">未参与</span>
<% elsif @homework.homework_detail_manual.comment_status >= 2 && student_work.student_works_evaluation_distributions.count == 0 %>
@ -84,8 +86,6 @@
<% end %>
<% else %>
<%=format("%.1f",student_work.student_score) %>
<% end %>
<% unless student_work.student_score.nil?%>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>)
</span>
@ -97,7 +97,7 @@
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.student_score)%>&nbsp;</span>分。
</div>
<% end%>
<% end %>
</td>
<% end %>
<!-- 成绩 -->
@ -106,9 +106,9 @@
<% else %>
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
<% end %>
<td class="hworkList70 <%= score_color score%> student_final_scor_info pr">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<td class="hworkList70 <%= score_color (!score_open || score.nil? ? nil : score)%> student_final_scor_info pr">
<%= !score_open || score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless !score_open || score.nil?%>
<div class="score-tip none tl" style="line-height: 18px;">
<em></em>
<font></font>

View File

@ -80,8 +80,8 @@
<!-- 成绩 -->
<% if @homework.homework_type == 2%>
<!-- 系统评分 -->
<td class="hworkList70 <%= score_color student_work.system_score%>">
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
<td class="hworkList70 <%= score_color (!score_open || student_work.system_score.nil? ? nil : student_work.system_score)%>">
<%= !score_open || student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
</td>
<% end%>

View File

@ -2,8 +2,9 @@
<% student_work_groups = @homework.student_works.where("user_id in #{user_ids}").order("created_at asc") %>
<% anon_count = student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
<% student_work_groups.each_with_index do |st, j| %>
<% score_open = @is_teacher || @homework.score_open == 1 || st.user == User.current %>
<div class="syllabus_class_box" id="student_work_<%= st.id%>" style="background-color:#fff;">
<%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count} %>
<%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count, :score_open => score_open} %>
</div>
<div id="about_hwork_<%= st.id %>" class="about_hwork"></div>
<% end %>

View File

@ -88,19 +88,19 @@
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<ul class="whomepagePostSettiongText">
<li>
<%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "postOptionLink"%>
<%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "wpostOptionLink"%>
</li>
<li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "wpostOptionLink") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) %>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) %>
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 2%>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 2%>
</li>
<li>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
@ -108,19 +108,22 @@
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "postOptionLink",
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
<li>
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true)%>
</li>
<% elsif activity.is_open == 1 %>
<li>
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true)%>
</li>
<% end %>
<li>
<%= link_to("成绩公开范围", alert_score_open_modal_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) %>
</li>
</ul>
</li>
</ul>

View File

@ -313,6 +313,8 @@ RedmineApp::Application.routes.draw do
get 'start_evaluation_set'
get 'score_rule_set'
post 'set_evaluation_attr'
get 'alert_score_open_modal'
post 'set_score_open'
end
collection do

View File

@ -0,0 +1,5 @@
class AddNoAnonPenaltyToHomeworkManual < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :no_anon_penalty, :integer, :default => 1
end
end

View File

@ -0,0 +1,5 @@
class AddScoreOpenToHomework < ActiveRecord::Migration
def change
add_column :homework_commons, :score_open, :integer, :default => 1
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161128072528) do
ActiveRecord::Schema.define(:version => 20161201083030) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -820,11 +820,13 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.integer "exercise_status"
t.integer "user_id"
t.integer "time"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "publish_time"
t.datetime "end_time"
t.integer "show_result"
t.integer "question_random", :default => 0
t.integer "choice_random", :default => 0
end
create_table "first_pages", :force => true do |t|
@ -964,6 +966,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do
t.integer "homework_common_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "no_anon_penalty", :default => 1
end
create_table "homework_detail_programings", :force => true do |t|

View File

@ -80,31 +80,28 @@ namespace :homework_evaluation do
homework_detail_manuals.each do |homework_detail_manual|
homework_common = homework_detail_manual.homework_common
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
#计算缺评扣分
#计算缺评扣分 参与匿评
work_ids = "(" + homework_common.student_works.has_committed.map(&:id).join(",") + ")"
if homework_common.homework_type != 3
homework_common.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
else
homework_common.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
if student_work.absence_penalty != 0
pros = student_work.student_work_projects.where("is_leader = 0")
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
student_works = homework_common.student_works.where("user_id in #{user_ids}")
student_works.each do |st_work|
absence_penalty_count = st_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - st_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
st_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
st_work.save
end
homework_common.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
# 未参与匿评
if homework_common.homework_detail_manual.no_anon_penalty == 0
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
homework_common.student_works.where("work_status != 0").each do |student_work|
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count == 0
student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count
student_work.save
end
end
end
homework_detail_manual.update_column('comment_status', 3)
# 匿评关闭消息通知 给所有人发
course = homework_common.course

View File

@ -183,6 +183,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mw380 {max-width: 380px !important;}
.mw400 {max-width: 400px !important;}
.mw450 {max-width: 450px !important;}
.mw550 {max-width: 550px !important;}
.mt-20 {margin-top:-20px;}
.mt-10 {margin-top:-10px;}
.mt-4 {margin-top:-4px;}

View File

@ -594,9 +594,9 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.exercise_status_end{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -659px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_com{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -681px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_nocom{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -705px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;}
a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:25px; display:block;float:right;}
a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;}
.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;}
.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:25px; display:block;float:right; margin-right:10px;}
a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;}
/*首页课程列表归档按钮提示*/

View File

@ -236,12 +236,14 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostSetting ul li:hover ul {display:block;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; text-align:center; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;z-index:999; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}
.whomepagePostSettiongText {width:100px; text-align:center; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-80px; top:20px; padding:5px 0px; display:none;z-index:999; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat; cursor: pointer;}
.whiteSettingIcon {background:url(/images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(/images/homepage_icon.png) -93px -44px no-repeat;}
a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;}
a.postOptionLink:hover {color:#ffffff; background-color:#3b94d6;}
a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;}
a.wpostOptionLink {color:#616060; display:block; width:80px; padding:0px 10px;text-align:center;}
a.wpostOptionLink:hover {color:#ffffff; background-color:#3b94d6;}a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;}
a.postOptionLink2:hover {color:#ffffff; background-color:#3b94d6;}
.homepagePostReplyPortrait {float:left; width:33px;}
.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;}

View File

@ -15,7 +15,7 @@ a.newbtn{ float:right; display:block; width:80px; height:27px; padding-top:3px;
a:hover.newbtn{ background:#55a1b9; text-decoration:none;}
.polls_list_ul{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:32px; padding-top:8px;}
a.polls_title{ font-weight:bold; color:#3e6d8e; margin-top:3px;}
a.pollsbtn{ display:block; width:66px; height:20px; padding-top:2px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;}
a.pollsbtn{ display:block; height:20px; padding:0 9px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;}
a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
.polls_date{ color:#666666;margin-top:3px; }
.polls_de{ color:#6883b6; margin-top:3px;}
@ -129,7 +129,7 @@ a.btn_de{ border:1px solid #ff5d31; color:#ff5d31; }
a:hover.btn_de{ background:#ff5d31;}
a.btn_pu{ border:1px solid #3cb761; color:#3cb761; }
a:hover.btn_pu{ background:#3cb761;}
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; }
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:20px;}
.polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.polls_title_st { max-width:450px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.polls_de_grey{ color:#b1b1b1; margin-top:3px;}