禁用匿评功能
This commit is contained in:
parent
c8eb0a076f
commit
ee7b21de72
|
@ -3,11 +3,11 @@ class StudentWorkController < ApplicationController
|
|||
include StudentWorkHelper
|
||||
require 'bigdecimal'
|
||||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule]
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
|
||||
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule]
|
||||
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
|
||||
|
||||
###
|
||||
def program_test
|
||||
|
@ -469,6 +469,25 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def forbidden_anonymous_comment
|
||||
@homework.update_column('anonymous_comment', 1)
|
||||
homework_detail_manual = @homework.homework_detail_manual
|
||||
homework_detail_programing = @homework.homework_detail_programing
|
||||
if homework_detail_programing
|
||||
homework_detail_manual.update_column('ta_proportion', 0.4)
|
||||
homework_detail_programing.update_column('ta_proportion', 0.6)
|
||||
else
|
||||
homework_detail_manual.update_column('ta_proportion', 1.0)
|
||||
end
|
||||
@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
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
private
|
||||
#获取作业
|
||||
def find_homework
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<% act = activity.course_act %>
|
||||
<% case activity.course_act_type.to_s %>
|
||||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :course_activity => 1} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'Message' %>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#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");
|
|
@ -0,0 +1,16 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<h2>禁用匿评</h2>
|
||||
<p>
|
||||
禁用匿评后学生将不能对作品进行互评,且匿评不能再开启,是否确定禁用匿评?
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK('<%= forbidden_anonymous_comment_student_work_path(:homework=>@homework, :user_activity_id => user_activity_id, :course_activity => course_activity)%>');" style="margin-bottom: 20px;" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -35,12 +35,14 @@
|
|||
</li>
|
||||
<% end%>
|
||||
|
||||
<% if @homework.anonymous_comment == 0%>
|
||||
<li class="hworkList50 hworkH30">
|
||||
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%>
|
||||
<% if @show_all && @order == "student_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
|
||||
<% end%>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li class="hworkList50 hworkH30">
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml10",:remote => true%>
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
</li>
|
||||
<% end%>
|
||||
|
||||
<% if @homework.anonymous_comment == 0%>
|
||||
<li class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
|
||||
<%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%>
|
||||
<% unless student_work.student_score.nil?%>
|
||||
|
@ -61,7 +62,7 @@
|
|||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<li class="hworkList50 <%= score_color score%> student_final_scor_info">
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<% if @user_activity_id == -1 %>
|
||||
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
|
||||
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
|
||||
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
|
||||
<% end %>
|
|
@ -57,25 +57,33 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<% if is_teacher%>
|
||||
<% comment_status = activity.homework_detail_manual.comment_status %>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => 0), :class => "postOptionLink"%>
|
||||
<%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
|
||||
</li>
|
||||
<% if activity.anonymous_comment == 0 %>
|
||||
<li>
|
||||
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
|
||||
</li>
|
||||
<li>
|
||||
<%= homework_anonymous_comment activity %>
|
||||
</li>
|
||||
<% 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,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
.ke-inline-block{display: none;}
|
||||
div.ke-container{float:left;}
|
||||
</style>
|
||||
<% first_user_activity = user_activities.first.id unless user_activities.first.nil? %>
|
||||
<% user_activities.each do |user_activity|
|
||||
if user_activities %>
|
||||
<script>
|
||||
|
@ -63,13 +62,13 @@
|
|||
<% if act %>
|
||||
<% case user_activity.act_type.to_s %>
|
||||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||
<% when 'Course'%>
|
||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
|
||||
<% end %>
|
||||
|
@ -78,11 +77,11 @@
|
|||
<% if act %>
|
||||
<% case user_activity.act_type.to_s %>
|
||||
<% when 'Issue' %>
|
||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'ProjectCreateInfo'%>
|
||||
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% when 'Principal' %>
|
||||
|
@ -101,7 +100,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||
<%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -18,11 +18,20 @@
|
|||
<% if homework_common.homework_detail_manual.comment_status == 0 %>
|
||||
<span class="grey_btn_cir ml10">未发布</span>
|
||||
<% elsif homework_common.homework_detail_manual.comment_status == 1%>
|
||||
<span class="grey_btn_cir ml10">未开启匿评</span>
|
||||
<% if homework_common.anonymous_comment == 0%>
|
||||
<span class="grey_btn_cir ml5">未开启匿评</span>
|
||||
<% end %>
|
||||
<span class="green_btn_cir ml10">作品提交中</span>
|
||||
<% elsif homework_common.homework_detail_manual.comment_status == 2%>
|
||||
<span class="green_btn_cir ml10">匿评中</span>
|
||||
<% if homework_common.anonymous_comment == 0%>
|
||||
<span class="green_btn_cir ml5">匿评中</span>
|
||||
<% end %>
|
||||
<span class="green_btn_cir ml10">教师教辅评阅中</span>
|
||||
<% elsif homework_common.homework_detail_manual.comment_status == 3%>
|
||||
<span class="grey_btn_cir ml10">匿评已结束</span>
|
||||
<% if homework_common.anonymous_comment == 0%>
|
||||
<span class="grey_btn_cir ml5">匿评已结束</span>
|
||||
<% end %>
|
||||
<span class="green_btn_cir ml10">教师教辅评阅中</span>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
||||
|
@ -64,28 +73,35 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<% if is_teacher%>
|
||||
<%# if false%>
|
||||
<% comment_status = homework_common.homework_detail_manual.comment_status%>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course), :class => "postOptionLink"%>
|
||||
<%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course),:class => "postOptionLink", :remote => true) %>
|
||||
</li>
|
||||
<% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
|
||||
<li>
|
||||
<% if homework_common.homework_detail_manual.comment_status == 0 || homework_common.homework_detail_manual.comment_status == 1%>
|
||||
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true)%>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
|
||||
<li>
|
||||
<%= homework_anonymous_comment homework_common %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
||||
<li>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -101,10 +101,12 @@ RedmineApp::Application.routes.draw do
|
|||
get 'start_anonymous_comment'
|
||||
get 'stop_anonymous_comment'
|
||||
get 'alert_anonymous_comment'
|
||||
get 'alert_forbidden_anonymous_comment'
|
||||
get 'start_evaluation_set'
|
||||
get 'score_rule_set'
|
||||
post 'set_evaluation_attr'
|
||||
end
|
||||
|
||||
collection do
|
||||
post 'next_step'
|
||||
post 'programing_test'
|
||||
|
@ -115,6 +117,7 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
post 'add_score'
|
||||
get 'praise_student_work'
|
||||
get 'forbidden_anonymous_comment'
|
||||
end
|
||||
collection do
|
||||
post 'add_score_reply'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddAnonymousCommentToHomeworkCommon < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :homework_commons, :anonymous_comment, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151029030006) do
|
||||
ActiveRecord::Schema.define(:version => 20151102085318) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -658,6 +658,7 @@ ActiveRecord::Schema.define(:version => 20151029030006) do
|
|||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "teacher_priority", :default => 1
|
||||
t.integer "anonymous_comment", :default => 0
|
||||
end
|
||||
|
||||
create_table "homework_detail_manuals", :force => true do |t|
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace :homework_evaluation do
|
|||
homework_detail_manuals = HomeworkDetailManual.where("evaluation_start = '#{Date.today}'")
|
||||
homework_detail_manuals.each do |homework_detail_manual|
|
||||
homework_common = homework_detail_manual.homework_common
|
||||
if homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
|
||||
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
|
||||
student_works = homework_common.student_works
|
||||
if student_works && student_works.size >= 2
|
||||
student_works.each_with_index do |work, index|
|
||||
|
@ -55,7 +55,7 @@ namespace :homework_evaluation do
|
|||
homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'")
|
||||
homework_detail_manuals.each do |homework_detail_manual|
|
||||
homework_common = homework_detail_manual.homework_common
|
||||
if homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
|
||||
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
|
||||
#计算缺评扣分
|
||||
work_ids = "(" + homework_common.student_works.map(&:id).join(",") + ")"
|
||||
homework_common.student_works.each do |student_work|
|
||||
|
|
Loading…
Reference in New Issue