Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
huang 2017-09-13 17:17:01 +08:00
commit b5f8da0ece
12 changed files with 111 additions and 92 deletions

View File

@ -251,7 +251,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_programing.ta_proportion = 0 if @homework_detail_programing @homework_detail_programing.ta_proportion = 0 if @homework_detail_programing
end end
if @homework_detail_manual.comment_status < 4 if @homework_detail_manual.comment_status < 4
if params[:homework_anonymous_appeal] if params[:homework_anonymous_comment] && params[:homework_anonymous_appeal]
@homework.anonymous_appeal = 1 @homework.anonymous_appeal = 1
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time] @homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty] @homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
@ -338,7 +338,6 @@ class HomeworkCommonController < ApplicationController
if @homework.end_time < Time.now if @homework.end_time < Time.now
@homework.student_works.each do |student_work| @homework.student_works.each do |student_work|
set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
student_work.save
end end
end end
end end

View File

@ -678,7 +678,7 @@ end
@courses = @courses.where(:homepage_show => params[:homepage_show].to_i) @courses = @courses.where(:homepage_show => params[:homepage_show].to_i)
end end
if params[:course_list] if params[:course_list] && params[:course_list] != ''
@courses = @courses.where(:course_list_id => courselist) @courses = @courses.where(:course_list_id => courselist)
end end
if params[:status] && params[:status]!='' if params[:status] && params[:status]!=''

View File

@ -562,11 +562,14 @@ class ShixunsController < ApplicationController
# end # end
# @shixun.major_id = params[:major_id] # @shixun.major_id = params[:major_id]
@shixun.shixun_major_courses.destroy_all @shixun.shixun_major_courses.destroy_all
if CourseList.where(:name => params[:course_list].strip).count > 0 course_lists = params[:course_list].strip.split(",")
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id) course_lists.each do |course|
else if CourseList.where(:name => course).count > 0
course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0) @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => course.strip).first.id)
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id) else
course_list = CourseList.create(:name => course.strip, :user_id => User.current.id, :is_admin => 0)
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id)
end
end end
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0 params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@ -686,9 +689,9 @@ class ShixunsController < ApplicationController
@user = User.current @user = User.current
if !params[:search].nil? if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%" search = "%#{params[:search].to_s.strip.downcase}%"
@courses = @user.courses.not_deleted_not_end.where("#{Course.table_name}.name like :p",:p=>search).select{|course| @user.allowed_to?(:as_teacher,course)} @courses = @user.courses.not_deleted_not_end.where("#{Course.table_name}.name like :p",:p=>search).select{|course| @user.has_teacher_role(course)}
else else
@courses = @user.courses.not_deleted_not_end.select{|course| @user.allowed_to?(:as_teacher,course)} @courses = @user.courses.not_deleted_not_end.select{|course| @user.has_teacher_role(course)}
end end
@pages = Paginator.new @courses.count, 8, params['page'] || 1 @pages = Paginator.new @courses.count, 8, params['page'] || 1
@offset ||= @pages.offset @offset ||= @pages.offset
@ -718,11 +721,11 @@ class ShixunsController < ApplicationController
homework_detail_manual.evaluation_num = 0 homework_detail_manual.evaluation_num = 0
homework_detail_manual.absence_penalty = 0 homework_detail_manual.absence_penalty = 0
homework.homework_detail_manual = homework_detail_manual homework.homework_detail_manual = homework_detail_manual
if homework.save if homework.save!
homework_detail_manual.save if homework_detail_manual homework_detail_manual.save if homework_detail_manual
HomeworkCommonsShixuns.create(:homework_common_id => homework.id, :shixun_id => @shixun.id) HomeworkCommonsShixuns.create(:homework_common_id => homework.id, :shixun_id => @shixun.id)
redirect_to setting_homework_common_path(homework, :is_new => 1)
end end
redirect_to setting_homework_common_path(homework, :is_new => 1)
end end
private private
# REDO: 新增类型copy的时候 # REDO: 新增类型copy的时候

View File

@ -377,11 +377,11 @@ class StudentWorkController < ApplicationController
end end
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 #开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? if (@homework.work_public && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin?
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}") @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}")
@show_all = true @show_all = true
elsif User.current.member_of_course?(@course) elsif User.current.member_of_course?(@course)
if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 #学生 && 未开启匿评 只看到自己的 if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 || @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
@stundet_works = !my_work.balnk? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : [] @stundet_works = !my_work.balnk? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : []
@ -391,14 +391,14 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 # elsif @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first # my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
if !my_work || my_work.status == 0 # if !my_work || my_work.status == 0
@stundet_works = [] # @stundet_works = []
else # else
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}") # @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}")
@show_all = true # @show_all = true
end # end
else else
@stundet_works = [] @stundet_works = []
end end
@ -408,11 +408,11 @@ class StudentWorkController < ApplicationController
end end
else else
if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? if (@homework.work_public && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin?
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}") @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}")
@show_all = true @show_all = true
elsif User.current.member_of_course?(@course) elsif User.current.member_of_course?(@course)
if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 #学生 && 未开启匿评 只看到自己的 if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 || @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
@stundet_works = !my_work.blank? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : [] @stundet_works = !my_work.blank? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : []
@ -422,14 +422,14 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 # elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first # my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
if !my_work || my_work.status == 0 # if !my_work || my_work.work_status == 0
@stundet_works = [] # @stundet_works = []
else # else
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}") # @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}")
@show_all = true # @show_all = true
end # end
else else
@stundet_works = [] @stundet_works = []
end end

View File

@ -283,7 +283,7 @@ module ApplicationHelper
if myshixun.nil? if myshixun.nil?
0 0
else else
myshixun.games.select{|game| game.status == 2 && game.answer_open == 0}.count myshixun.games.select{|game| game.status == 2 && !game.answer_open}.count
end end
end end
@ -358,18 +358,23 @@ module ApplicationHelper
day = time / 86400 day = time / 86400
hour = time % (24*60*60) / (60*60) hour = time % (24*60*60) / (60*60)
min = time % (24*60*60) % (60*60) / 60 min = time % (24*60*60) % (60*60) / 60
sec = time % (24*60*60) % (60*60) % 60
if day < 1 if day < 1
if hour < 1 if hour < 1
if time < 1 if min < 1
time = time == 0 ? "--" : "小于1分钟" if sec < 1
time = "--"
else
time = "#{sec}"
end
else else
time = "#{min} 分钟" time = "#{min}分钟 #{sec}"
end end
else else
time = "#{hour}小时 : #{min}" time = "#{hour}小时 #{min}#{sec}"
end end
else else
time = "#{day}#{hour}小时 #{min}" time = "#{day}#{hour}小时 #{min}#{sec}"
end end
return time return time
end end
@ -4736,6 +4741,7 @@ end
def get_hw_index(hw,is_teacher,type=0) def get_hw_index(hw,is_teacher,type=0)
homework_commons = hw.course.homework_commons homework_commons = hw.course.homework_commons
Rails.logger.info("----------------------------------------------"+hw.course.to_s)
if is_teacher if is_teacher
if type != 0 if type != 0
homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc") homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc")
@ -4749,7 +4755,8 @@ def get_hw_index(hw,is_teacher,type=0)
homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc") homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
end end
end end
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty? Rails.logger.info("----------------------------------------------"+homeworks.count.to_s)
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank?
index = hw_ids.index(hw.id) index = hw_ids.index(hw.id)
return index return index
end end
@ -5224,9 +5231,9 @@ def set_shixun_final_score homework, student_work, answer_open_evaluation
shixun = homework.homework_commons_shixuns.shixun shixun = homework.homework_commons_shixuns.shixun
passed_count = answer_open_evaluation ? had_passed_changllenge_num(shixun, student_work.user) : had_passed_no_ans_changllenge_num(shixun, student_work.user) passed_count = answer_open_evaluation ? had_passed_changllenge_num(shixun, student_work.user) : had_passed_no_ans_changllenge_num(shixun, student_work.user)
final_score =(passed_count.to_f / shixun.challenges.count) * 100 final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.final_score = format("%.2f",final_score.to_f) student_work.update_column("final_score", format("%.2f",final_score.to_f))
score = student_work.final_score - student_work.late_penalty score = student_work.final_score - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f)) if score
end end
end end

View File

@ -1,4 +1,4 @@
<div class="new_roadmap_conbox mb10" > <div class="new_roadmap_conbox mb10 mt15">
<div class=" clear"> <div class=" clear">
<ul class="reply-container-branch fl" > <ul class="reply-container-branch fl" >
<%= render :partial => 'shixun_navigation' %> <%= render :partial => 'shixun_navigation' %>

View File

@ -1,4 +1,4 @@
<div class="container-big"> <div class="container-big mt15">
<div class="new_roadmap_conbox mb10" > <div class="new_roadmap_conbox mb10" >
<div class="new_roadmap_info_top clear "> <div class="new_roadmap_info_top clear ">
<%=link_to "<span class='new_roadmap_icons_back mr5'></span>返回提交历史".html_safe, <%=link_to "<span class='new_roadmap_icons_back mr5'></span>返回提交历史".html_safe,

View File

@ -3,9 +3,14 @@
<em></em> <em></em>
<span></span> <span></span>
<p class="font-12"> <p class="font-12">
使用Git提交代码时请在Git客户端填写如下信息<br/> 提交代码的方法:<br/>
* 用户名:请使用您绑定的邮箱<br/> 1、在你自己的电脑安装Git tortoise客户端<br/>
* 口令:请使用您的登录口令<br/> 或者其他你熟悉的Git客户端<br/>
2、在Git客户端向左侧的地址提交代码。<br/>
注意:<br/>
请务必在Git客户端填写如下信息<br/>
* 用户名:使用您在本平台绑定的邮箱<br/>
* 口令:使用您在本平台的登录口令<br/>
</p> </p>
</div> </div>
<div class="repository_con" style="line-height:1.9;"> <div class="repository_con" style="line-height:1.9;">

View File

@ -309,12 +309,12 @@
} else{ } else{
$("#stage_name_notice").hide(); $("#stage_name_notice").hide();
} }
if($("input[name='shixun_id[]']").length == 0){ // if($("input[name='shixun_id[]']").length == 0){
status = false; // status = false;
$("#sx_none_notice").show(); // $("#sx_none_notice").show();
} else{ // } else{
$("#sx_none_notice").hide(); // $("#sx_none_notice").hide();
} // }
if(status && flag){ if(status && flag){
flag = false; flag = false;
$("#new_stage_form").submit(); $("#new_stage_form").submit();

View File

@ -223,7 +223,7 @@
<% if User.current.mail.blank? %> <% if User.current.mail.blank? %>
<li><a href="javascript:void(0)" class="color-light-green fr font-14 mr20" style="line-height:56px" onclick="shixun_valication()">+&nbsp;新建</a></li> <li><a href="javascript:void(0)" class="color-light-green fr font-14 mr20" style="line-height:56px" onclick="shixun_valication()">+&nbsp;新建</a></li>
<% else %> <% else %>
<li><%= link_to "+ 新建", new_shixun_path, :target => "_blank", :class => "color-light-green fr font-14 mr20", :style => "line-height:56px" %></li> <li><%= link_to "+ 新建", new_shixun_path, :class => "color-light-green fr font-14 mr20", :style => "line-height:56px" %></li>
<% end %> <% end %>
</div> </div>
<div class="lesson clearfix homepage-list-show" id="my_shixuns_list"> <div class="lesson clearfix homepage-list-show" id="my_shixuns_list">

View File

@ -86,10 +86,10 @@ namespace :homework_publishtime do
homework.student_works.where("work_status != 0").each do |student_work| homework.student_works.where("work_status != 0").each do |student_work|
passed_count = homework.homework_detail_manual.answer_open_evaluation ? had_passed_changllenge_num_rake(student_work.myshixun) : had_passed_no_ans_changllenge_num_rake(student_work.myshixun) passed_count = homework.homework_detail_manual.answer_open_evaluation ? had_passed_changllenge_num_rake(student_work.myshixun) : had_passed_no_ans_changllenge_num_rake(student_work.myshixun)
final_score =(passed_count.to_f / shixun.challenges.count) * 100 final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.final_score = format("%.2f",final_score.to_f) student_work.update_column("final_score", format("%.2f",final_score.to_f))
score = student_work.final_score - student_work.late_penalty score = student_work.final_score - student_work.late_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
student_work.save student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f))
end end
end end
end end

View File

@ -275,11 +275,13 @@ $(function(){
$(this).parent().parent('ul').find('input[type="text"]').removeAttr('disabled'); $(this).parent().parent('ul').find('input[type="text"]').removeAttr('disabled');
$(this).parent().parent('ul').find('input[type="text"]').removeClass('disabled-bg'); $(this).parent().parent('ul').find('input[type="text"]').removeClass('disabled-bg');
$("#anon_relate_setting_ul").show(); $("#anon_relate_setting_ul").show();
var my_date = new Date(); if($("input[name='homework_end_time']").val().trim() != ""){
var end_date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/"))); var my_date = new Date();
var max_date = my_date > end_date ? my_date : end_date; var end_date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
$("input[name='homework_evaluation_start']").val(formate_time(new Date(max_date.setDate(max_date.getDate()+7)))); var max_date = my_date > end_date ? my_date : end_date;
$("input[name='homework_evaluation_end']").val(formate_time(new Date(max_date.setDate(max_date.getDate()+14)))); $("input[name='homework_evaluation_start']").val(formate_time(new Date(max_date.setDate(max_date.getDate()+7))));
$("input[name='homework_evaluation_end']").val(formate_time(new Date(max_date.setDate(max_date.getDate()+14))));
}
$("input[name='homework_evaluation_num']").val("3"); $("input[name='homework_evaluation_num']").val("3");
$("input[name='homework_absence_penalty']").val("2"); $("input[name='homework_absence_penalty']").val("2");
$("select[name='st_proportion']").removeAttr('disabled').removeClass('disabled-bg'); $("select[name='st_proportion']").removeAttr('disabled').removeClass('disabled-bg');
@ -305,10 +307,12 @@ $(function(){
if($(this).is(':checked')){ if($(this).is(':checked')){
$(this).parent().parent('ul').find('input[type="text"]').removeAttr('disabled'); $(this).parent().parent('ul').find('input[type="text"]').removeAttr('disabled');
$(this).parent().parent('ul').find('input[type="text"]').removeClass('disabled-bg'); $(this).parent().parent('ul').find('input[type="text"]').removeClass('disabled-bg');
var my_date = new Date(); if($("input[name='homework_evaluation_end']").val().trim() != ""){
var end_date = new Date(Date.parse($("input[name='homework_evaluation_end']").val().replace(/-/g, "/"))); var my_date = new Date();
var max_date = my_date > end_date ? my_date : end_date; var end_date = new Date(Date.parse($("input[name='homework_evaluation_end']").val().replace(/-/g, "/")));
$("input[name='homework_appeal_time']").val(formate_time(new Date(max_date.setDate(max_date.getDate()+2)))); var max_date = my_date > end_date ? my_date : end_date;
$("input[name='homework_appeal_time']").val(formate_time(new Date(max_date.setDate(max_date.getDate()+2))));
}
$("input[name='homework_appeal_penalty']").val("2"); $("input[name='homework_appeal_penalty']").val("2");
} else{ } else{
$(this).parent().parent('ul').find('input[type="text"]').attr('disabled', 'disabled'); $(this).parent().parent('ul').find('input[type="text"]').attr('disabled', 'disabled');
@ -435,36 +439,37 @@ $(function(){
$("#homework_absence_penalty_notice").hide(); $("#homework_absence_penalty_notice").hide();
} }
} }
}
if($("input[name='homework_anonymous_appeal']").is(':checked')){ if($("input[name='homework_anonymous_appeal']").is(':checked')){
if($.trim($("input[name='homework_appeal_time']").val()) == ""){ if($.trim($("input[name='homework_appeal_time']").val()) == ""){
$("#homework_appeal_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>申诉结束时间不能为空").show(); $("#homework_appeal_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>申诉结束时间不能为空").show();
result = false;
} else{
var archive_time = Date.parse($("input[name='homework_archive_time']").val());
var eva_end = Date.parse($("input[name='homework_evaluation_end']").val());
var appeal_time = Date.parse($("input[name='homework_appeal_time']").val());
if(eva_end >= appeal_time){
$("#homework_appeal_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>申诉结束时间应晚于匿评结束时间").show();
result = false; result = false;
} else if(archive_time <= appeal_time){
$("#homework_appeal_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>申诉结束时间应早于作业结束时间").show();
result = false;
} else {
$("#homework_appeal_time_notice").hide();
}
}
if($.trim($("input[name='homework_appeal_penalty']").val()) == ""){
result = false;
$("#homework_appeal_penalty_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>违规匿评扣分不能为空").show();
} else{
var str = $.trim($("input[name='homework_appeal_penalty']").val());
var regex = /^\d+$/;
if(!regex.test(str) || parseInt(str) < 0 || parseInt(str) > 50) {
result = false;
$("#homework_appeal_penalty_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>请输入0-50之间的正整数").show();
} else{ } else{
$("#homework_appeal_penalty_notice").hide(); var archive_time = Date.parse($("input[name='homework_archive_time']").val());
var eva_end = Date.parse($("input[name='homework_evaluation_end']").val());
var appeal_time = Date.parse($("input[name='homework_appeal_time']").val());
if(eva_end >= appeal_time){
$("#homework_appeal_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>申诉结束时间应晚于匿评结束时间").show();
result = false;
} else if(archive_time <= appeal_time){
$("#homework_appeal_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>申诉结束时间应早于作业结束时间").show();
result = false;
} else {
$("#homework_appeal_time_notice").hide();
}
}
if($.trim($("input[name='homework_appeal_penalty']").val()) == ""){
result = false;
$("#homework_appeal_penalty_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>违规匿评扣分不能为空").show();
} else{
var str = $.trim($("input[name='homework_appeal_penalty']").val());
var regex = /^\d+$/;
if(!regex.test(str) || parseInt(str) < 0 || parseInt(str) > 50) {
result = false;
$("#homework_appeal_penalty_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>请输入0-50之间的正整数").show();
} else{
$("#homework_appeal_penalty_notice").hide();
}
} }
} }
} }