Merge branch 'Poll' into szzh
This commit is contained in:
commit
b0b2fe7148
|
@ -91,15 +91,37 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.end_time = params[:homework_common][:end_time]
|
||||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
@homework.homework_type = params[:homework_common][:homework_type]
|
||||
unless @homework.late_penalty == params[:late_penalty]
|
||||
@homework.student_works.where("late_penalty != 0").each do |student_work|
|
||||
student_work.late_penalty = params[:late_penalty]
|
||||
student_work.save
|
||||
end
|
||||
@homework.late_penalty = params[:late_penalty]
|
||||
end
|
||||
@homework.course_id = @course.id
|
||||
|
||||
#匿评作业相关属性
|
||||
if @homework.homework_type == 1
|
||||
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
@homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
@homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
@homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
unless @homework_detail_manual.absence_penalty == params[:absence_penalty]
|
||||
if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
@homework.student_works.where("absence_penalty != 0").each do |student_work|
|
||||
student_work.absence_penalty = student_work.absence_penalty / @homework_detail_manual.absence_penalty * params[:absence_penalty].to_i
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
@homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
end
|
||||
else #不是匿评作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业
|
||||
@homework.student_works.where("absence_penalty != 0").each do |student_work|
|
||||
student_work.late_penalty = 0
|
||||
student_work.save
|
||||
end
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
end
|
||||
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
@ -161,6 +183,14 @@ class HomeworkCommonController < ApplicationController
|
|||
#关闭匿评
|
||||
def stop_anonymous_comment
|
||||
@homework_detail_manual.update_column('comment_status', 3)
|
||||
|
||||
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
||||
@homework.student_works.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}").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -9,32 +9,32 @@ class StudentWorkController < ApplicationController
|
|||
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list]
|
||||
|
||||
def index
|
||||
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
|
||||
@order,@b_sort,@name = params[:order] || "score",params[:sort] || "desc",params[:name] || ""
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
|
||||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin?
|
||||
if @show_all
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin?
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品
|
||||
my_work = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
end
|
||||
end
|
||||
else #学生
|
||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||
@stundet_works = @homework.student_works.where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
|
||||
@is_evaluation = true
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
|
@ -42,6 +42,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
@ -73,6 +74,11 @@ class StudentWorkController < ApplicationController
|
|||
stundet_work.homework_common_id = @homework.id
|
||||
stundet_work.user_id = User.current.id
|
||||
stundet_work.save_attachments(params[:attachments])
|
||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
stundet_work.late_penalty = @homework.late_penalty
|
||||
else
|
||||
stundet_work.late_penalty = 0
|
||||
end
|
||||
render_attachment_warning_if_needed(stundet_work)
|
||||
if stundet_work.save
|
||||
respond_to do |format|
|
||||
|
|
|
@ -15,7 +15,7 @@ module HomeworkCommonHelper
|
|||
#教辅评分比例下拉框
|
||||
def ta_proportion_option
|
||||
type = []
|
||||
i = 10
|
||||
i = 0
|
||||
while i <= 100
|
||||
option = []
|
||||
option << i.to_s + "%"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<p class="fl ml20 f14 mb10 c_orange">基本规则设置(总分为100分)</p>
|
||||
<div class="cl"></div>
|
||||
<ul class="ml10">
|
||||
<li style="display: none;">
|
||||
<li>
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="fl mt5"> 分</span>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<li style="display: none;">
|
||||
<li>
|
||||
<label class="label02">缺评扣分: </label>
|
||||
<%= select_tag :absence_penalty,options_for_select(absence_penalty_option,homework.homework_detail_manual.absence_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="fl mt5"> 分</span>
|
||||
|
|
|
@ -38,8 +38,34 @@
|
|||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class=" hwork_score <%= score_color student_work.final_score%>">
|
||||
<%= student_work.final_score.nil? ? "--" : format("%.1f",student_work.final_score)%>
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : student_work.final_score - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<li class=" hwork_score <%= score_color score%> student_final_scor_info">
|
||||
<%= score.nil? ? "--" : format("%.1f",score)%>
|
||||
<% unless score.nil?%>
|
||||
<% if @homework.homework_type == 1%>
|
||||
<!-- 匿评作品显示缺评扣分 -->
|
||||
<div class="info_ni">
|
||||
作品最终评分为
|
||||
<span class="c_red"> <%= student_work.final_score%> </span>分。
|
||||
迟交扣分
|
||||
<span class="c_red"> <%= student_work.late_penalty%> </span>分,
|
||||
缺评扣分
|
||||
<span class="c_red"> <%= student_work.absence_penalty%> </span>分,
|
||||
最终成绩为
|
||||
<span class="c_red"> <%= score%> </span>分。
|
||||
</div>
|
||||
<% else%>
|
||||
<!-- 非匿评作品不显示缺评扣分 -->
|
||||
<div class="info_ni">
|
||||
作品最终评分为
|
||||
<span class="c_red"> <%= student_work.final_score%> </span>分。
|
||||
迟交扣分
|
||||
<span class="c_red"> <%= student_work.late_penalty%> </span>分,
|
||||
最终成绩为
|
||||
<span class="c_red"> <%= score%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
<% end%>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul><!---hwork_ul end-->
|
|
@ -36,8 +36,8 @@
|
|||
<% end%>
|
||||
</li>
|
||||
<li class="ml20">
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "final_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
|
@ -16,14 +16,26 @@ $("#score_list_<%= @work.id%>").removeAttr("style");
|
|||
|
||||
|
||||
$(function(){
|
||||
//匿评评分提示
|
||||
$(".student_score_info").bind("mouseover",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").show();
|
||||
$(this).find("div").css("top",e.pageY);
|
||||
$(this).find("div").css("left",e.pageX);
|
||||
// $(this).find("div").css("top",e.pageY);
|
||||
// $(this).find("div").css("left",e.pageX);
|
||||
});
|
||||
$(".student_score_info").bind("mouseout",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").hide();
|
||||
});
|
||||
//最终成绩提示
|
||||
$(".student_final_scor_info").bind("mouseover",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").show();
|
||||
// $(this).find("div").css("top",e.pageY);
|
||||
// $(this).find("div").css("left",e.pageX);
|
||||
});
|
||||
$(".student_final_scor_info").bind("mouseout",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").hide();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
|
||||
remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %>
|
||||
<% end%>
|
||||
<div class="info_ni">
|
||||
<div class="info_ni_download">
|
||||
使用
|
||||
<span class="c_red">winzip</span>
|
||||
工具进行解压可能会导致
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150630031857) do
|
||||
ActiveRecord::Schema.define(:version => 20150702073308) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1231,6 +1231,8 @@ ActiveRecord::Schema.define(:version => 20150630031857) do
|
|||
t.integer "project_id", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "late_penalty", :default => 0
|
||||
t.integer "absence_penalty", :default => 0
|
||||
end
|
||||
|
||||
create_table "student_works_evaluation_distributions", :force => true do |t|
|
||||
|
|
|
@ -788,13 +788,24 @@ $(function(){
|
|||
$(".student_score_info").bind("mouseover",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").show();
|
||||
$(this).find("div").css("top",e.pageY);
|
||||
$(this).find("div").css("left",e.pageX);
|
||||
//$(this).find("div").css("top",e.pageY);
|
||||
//$(this).find("div").css("left",e.pageX);
|
||||
});
|
||||
$(".student_score_info").bind("mouseout",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").hide();
|
||||
});
|
||||
//最终成绩提示
|
||||
$(".student_final_scor_info").bind("mouseover",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").show();
|
||||
//$(this).find("div").css("top",e.pageY);
|
||||
//$(this).find("div").css("left",e.pageX);
|
||||
});
|
||||
$(".student_final_scor_info").bind("mouseout",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").hide();
|
||||
});
|
||||
|
||||
$("#about_project label").eq(1).remove();
|
||||
|
||||
|
|
|
@ -654,7 +654,8 @@ a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px;
|
|||
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
|
||||
.fr{ float:right;}
|
||||
.li_min_search{ float:right; margin-right:-10px;}
|
||||
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 110px;margin-top: 10px;}
|
||||
.info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;}
|
||||
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 50px;margin-top: -5px;}
|
||||
/*返回顶部*/
|
||||
.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}
|
||||
.hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
|
||||
|
|
Loading…
Reference in New Issue