作业申诉

This commit is contained in:
cxt 2019-04-25 17:05:41 +08:00
parent 018af8350a
commit 28a913ad2f
7 changed files with 57 additions and 14 deletions

View File

@ -399,12 +399,18 @@ class StudentWorkController < ApplicationController
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && @homework.end_time < Time.now && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
if params[:appeal] && params[:appeal].to_i == 1
@stundet_works = @homework.student_works.no_copy.joins(:student_works_scores).where("reviewer_role = 3 and appeal_status = 1").
select("student_works.*,student_works.work_score as score").where("users.id in #{student_in_group}")
else
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@stundet_works = @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").where("users.id in #{student_in_group}")
end
if @order == 'lastname'
@stundet_works = search_homework_member @stundet_works.joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@stundet_works = search_homework_member @stundet_works.joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
else
@stundet_works = search_homework_member @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}"),@name
end
@show_all = true
elsif User.current.member_of_course?(@course)
@ -465,12 +471,18 @@ class StudentWorkController < ApplicationController
@student_work_count = (search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && @homework.end_time < Time.now && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
if params[:appeal] && params[:appeal].to_i == 1
@stundet_works = @homework.student_works.no_copy.joins(:student_works_scores).where("reviewer_role = 3 and appeal_status = 1").
select("student_works.*,student_works.work_score as score")
else
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}"),@name
@stundet_works = @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score")
end
if @order == 'lastname'
@stundet_works = search_homework_member @stundet_works.joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@stundet_works = search_homework_member @stundet_works.joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
else
@stundet_works = search_homework_member @stundet_works.includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}"),@name
end
@show_all = true
elsif User.current.member_of_course?(@course)
@ -977,6 +989,8 @@ class StudentWorkController < ApplicationController
add_score_to_member @work, @homework, @new_score
end
User.current.student_works_scores.where(student_work_id => @work.id, :reviewer_role => 3, :appeal_status => 1).update_all(:appeal_status => 5)
#更新CourseHomeworkStatistics中该学生的待匿评数, 只计算第一次评分
if User.current.student_works_scores.where(:student_work_id => @work.id, :reviewer_role => 3).count == 1
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, User.current.id)

View File

@ -264,6 +264,12 @@ class HomeworkCommon < ActiveRecord::Base
end
end
# 匿评申诉待处理条数
def appeal_deal_count
self.student_works.joins(:student_works_scores).where("reviewer_role = 3 and appeal_status = 1").count
end
delegate :language_name, :language, :to => :homework_detail_programing
end

View File

@ -1,7 +1,7 @@
#encoding=UTF-8
class StudentWorksScore < ActiveRecord::Base
#reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
#appeal_status: 0正常1申诉中2撤销申诉3申诉成功4申诉被拒绝
#appeal_status: 0正常1申诉中2撤销申诉3申诉成功4申诉被拒绝 5失效重新评分
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role, :is_hidden
belongs_to :user

View File

@ -36,6 +36,12 @@
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %>
<% end %>
<% end%>
<% if @is_teacher && @homework.homework_detail_manual.comment_status > 1 && @homework.anonymous_appeal == 1 %>
<div class="mt5 fr">
<input type="checkbox" name="appeal" <%= params[:appeal] == '1' ? "checked" : '' %> value="1" id="anonymous_appeal_check"/>
<label for="anonymous_appeal_check">待处理匿评申诉(<%= @homework.appeal_deal_count %></label>
</div>
<% end %>
<% if !@is_teacher && @homework.homework_type == 3 && my_work && my_work.user == User.current && @homework.end_time < Time.now %>
<div class="mt5 fr">
<a href="javascript:void(0);" class="memberBtn fl mt3" title="添加小组成员" onclick="add_or_delete_group_member();">合作成员</a>
@ -87,7 +93,6 @@
<% work= params[:show_work_id].nil? ? @homework.student_works.where("user_id = ?",User.current.id).first : StudentWork.find(params[:show_work_id]) %>
<% end %>
<% unless work.nil? %>
location.hash = "<%=work.id %>";
<% if @homework.homework_type == 2 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>");
@ -118,7 +123,10 @@
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>");
<% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %>
scroll_height(<%= work.id%>);
toggle_student_score(<%= work.id%>);
//location.hash = "<%=work.id %>";
<% end %>
<% end %>
});

View File

@ -102,6 +102,8 @@
<span class="c_red fr mr10">申诉成功</span>
<% elsif s_score.reviewer_role == 3 && s_score.appeal_status == 4 %>
<span class="c_red fr mr10">申诉失败</span>
<% elsif s_score.reviewer_role == 3 && s_score.appeal_status == 5 %>
<span class="c_red fr mr10">申诉已失效</span>
<% end %>
<% end %>
<span class="fr c_grey mr20">

View File

@ -2380,4 +2380,12 @@ function get_email_info(id, subject) {
});
}
}
}
function scroll_height(num){
window.location.href="#student_work_"+num;
var top=$(document).scrollTop();
//var mt=$("#homework_table").css("margin-top");
$(document).scrollTop(parseInt(top));
}

View File

@ -1450,7 +1450,8 @@ function SearchByName_1(url)
url,
{
name : $("#course_student_name").val(),
group : $("#student_work_in_group").val()
group : $("#student_work_in_group").val(),
appeal: $("#anonymous_appeal_check").is(":checked") ? 1 : 0
},
function (data) {
}
@ -1461,6 +1462,10 @@ $(function(){
$("#student_work_in_group").live("change",function(){
$("#search_in_student_work").click();
});
$("#anonymous_appeal_check").live("change",function(){
$("#search_in_student_work").click();
});
});
//新建作业临时弹框