实训作业的状态

dev_new_shixunsrepository
cxt 5 years ago
parent e20537680f
commit 7f571787c6

@ -305,13 +305,20 @@ class HomeworksService
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
if work.work_status == 0 is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time)
is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time)
if is_complete || (myshixun.created_at < setting_time.end_time && (!homework.allow_late || setting_time.end_time >= Time.now)) # if work.work_status == 0
work.work_status = 1 # if is_complete || (myshixun.created_at < setting_time.end_time && (!homework.allow_late || setting_time.end_time >= Time.now))
elsif homework.allow_late && myshixun.created_at < homework.late_time # work.work_status = 1
work.work_status = 2 # elsif homework.allow_late && myshixun.created_at < homework.late_time
end # work.work_status = 2
# end
# end
if !homework.allow_late || is_complete
work.work_status = 1
elsif myshixun.created_at < homework.late_time
work.work_status = 2
end end
if work.work_status != 0 if work.work_status != 0

@ -43,7 +43,8 @@ elsif @user_course_identity == Course::STUDENT
json.efficiency work_score_format(@work.efficiency, true, @score_open) json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open) json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late
json.complete_count @work.myshixun&.time_passed_count(@homework.homework_group_setting(@work.user_id)&.end_time) end_time = @homework.allow_late ? @homework.late_time : @homework.homework_group_setting(@work.user_id)&.end_time
json.complete_count @work.myshixun&.time_passed_count(end_time)
json.view_answer_count @work.myshixun.try(:view_answer_count).to_i json.view_answer_count @work.myshixun.try(:view_answer_count).to_i
json.work_status @work.compelete_status json.work_status @work.compelete_status
else else

@ -81,7 +81,7 @@ namespace :homework_publishtime do
end end
end end
student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if student_works.present? student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty, work_status: 2) if student_works.present?
else else
HomeworkEndUpdateScoreJob.perform_later(homework.id) HomeworkEndUpdateScoreJob.perform_later(homework.id)

Loading…
Cancel
Save