实训作业成绩的实时更新
This commit is contained in:
parent
2a619272bb
commit
48de3d1f35
|
|
@ -335,11 +335,11 @@ class HomeworkCommonController < ApplicationController
|
|||
if @homework.homework_type == 4
|
||||
if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation].to_i
|
||||
@homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation].to_i
|
||||
if @homework.end_time < Time.now
|
||||
@homework.student_works.each do |student_work|
|
||||
set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
|
||||
end
|
||||
end
|
||||
# if @homework.end_time < Time.now
|
||||
# @homework.student_works.each do |student_work|
|
||||
# set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
|
||||
# end
|
||||
# end
|
||||
end
|
||||
@homework.score_open = params[:homework_score_open] ? 1 : 0
|
||||
else
|
||||
|
|
|
|||
|
|
@ -359,8 +359,10 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
##################################################################################################################
|
||||
if @homework.homework_type == 4 && @homework.homework_detail_manual.comment_status > 0 && (@homework.publish_time > Time.now || (@homework.publish_time <= Time.now && @homework.allow_late))
|
||||
update_shixun_work_status @homework
|
||||
if params[:order].nil? && params[:sort].nil? && params[:name].nil? && params[:group].nil? && params[:comment].nil? && params[:status].nil?
|
||||
if @homework.homework_type == 4 && @homework.homework_detail_manual.comment_status > 0 && @homework.homework_detail_manual.comment_status != 6 && (@homework.end_time > Time.now || (@homework.end_time <= Time.now && @homework.allow_late))
|
||||
update_shixun_work_status @homework
|
||||
end
|
||||
end
|
||||
@order,@b_sort,@name,@group,@comment,@status = params[:order] || "updated_at",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group], params[:comment], params[:status]
|
||||
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now).order("created_at desc")
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@ include UserScoreHelper
|
|||
|
||||
module StudentWorkHelper
|
||||
def update_shixun_work_status homework
|
||||
homework.student_works.where(:work_status => 0).each do |work|
|
||||
myshixun = Myshixun.where(:shixun_id => homework.homework_commons_shixuns.shixun_id, :user_id => work.user_id).first
|
||||
if myshixun
|
||||
work.update_attributes(:work_status => myshixun.created_at <= homework.end_time ? 1 : 2, :late_penalty => myshixun.created_at <= homework.end_time ? 0 : homework.late_penalty, :commit_time => myshixun.created_at, :myshixun_id => myshixun.id)
|
||||
homework.student_works.each do |work|
|
||||
if work.work_status == 0
|
||||
myshixun = Myshixun.where(:shixun_id => homework.homework_commons_shixuns.shixun_id, :user_id => work.user_id).first
|
||||
if myshixun
|
||||
work.update_attributes(:work_status => myshixun.created_at <= homework.end_time ? 1 : 2, :late_penalty => myshixun.created_at <= homework.end_time ? 0 : homework.late_penalty, :commit_time => myshixun.created_at, :myshixun_id => myshixun.id)
|
||||
end
|
||||
end
|
||||
set_shixun_final_score homework, work, homework.homework_detail_manual.answer_open_evaluation
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -39,16 +39,16 @@ class StudentsForCourse < ActiveRecord::Base
|
|||
if str != ""
|
||||
str += ","
|
||||
end
|
||||
if hw.homework_type == 4
|
||||
myshixun = Myshixun.where(:shixun_id => hw.homework_commons_shixuns.shixun_id, :user_id => self.student_id).first
|
||||
if myshixun
|
||||
str += "('#{hw.name}的作品提交',#{hw.id},#{self.student_id}, 1, #{myshixun.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
|
||||
else
|
||||
str += "('#{hw.name}的作品提交',#{hw.id},#{self.student_id}, 0, null, null, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
|
||||
end
|
||||
else
|
||||
#if hw.homework_type == 4
|
||||
#myshixun = Myshixun.where(:shixun_id => hw.homework_commons_shixuns.shixun_id, :user_id => self.student_id).first
|
||||
# if myshixun
|
||||
# str += "('#{hw.name}的作品提交',#{hw.id},#{self.student_id}, 1, #{myshixun.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
|
||||
# else
|
||||
# str += "('#{hw.name}的作品提交',#{hw.id},#{self.student_id}, 0, null, null, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
|
||||
# end
|
||||
#else
|
||||
str += "('#{hw.name}的作品提交',#{hw.id},#{self.student_id}, 0, null, null, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')"
|
||||
end
|
||||
#end
|
||||
end
|
||||
end
|
||||
if str != ""
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace :homework_publishtime do
|
|||
homework_commons.each do |homework|
|
||||
homework_detail_manual = homework.homework_detail_manual
|
||||
homework_detail_manual.update_column('comment_status', 6)
|
||||
if homework.homework_type == 4
|
||||
if homework.homework_type == 4 && homework.allow_late
|
||||
shixun = homework.homework_commons_shixuns.shixun
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue