测验消息bug
This commit is contained in:
parent
e2f5dcc3f9
commit
dbfc4969e0
|
@ -9,6 +9,10 @@ class ExerciseController < ApplicationController
|
|||
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
|
||||
publish_exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 2)
|
||||
course = exercise.course
|
||||
course.members.each do |m|
|
||||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
end
|
||||
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
|
||||
end_exercises.each do |exercise|
|
||||
|
@ -35,6 +39,10 @@ class ExerciseController < ApplicationController
|
|||
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
|
||||
publish_exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 2)
|
||||
course = exercise.course
|
||||
course.members.each do |m|
|
||||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
end
|
||||
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
|
||||
end_exercises.each do |exercise|
|
||||
|
@ -504,6 +512,10 @@ class ExerciseController < ApplicationController
|
|||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
@exercise.update_attributes(:exercise_status => 2)
|
||||
@exercise.update_attributes(:publish_time => Time.now)
|
||||
course = @exercise.course
|
||||
course.members.each do |m|
|
||||
@exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
redirect_to exercise_url(@exercise)
|
||||
return
|
||||
elsif @exercise.publish_time > Time.now
|
||||
|
|
|
@ -640,9 +640,9 @@
|
|||
<!--<li>发布时间:<%#= ma.course_message.publish_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>-->
|
||||
<!--<%# end %>-->
|
||||
<li>截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>
|
||||
<li>答题时间:<%= ma.course_message.time == 0 ? '不限时' : ma.course_message.time.to_s + '分钟' %></li>
|
||||
<li>答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %></li>
|
||||
<% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
|
||||
<p>请记得在截止时间前完成测验噢,辛苦啦!</p>
|
||||
<p>请记得在截止时间前完成测验噢,辛苦啦!</p>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -674,7 +674,7 @@
|
|||
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
|
||||
<li>测验标题:<%= ma.course_message.exercise_name %></li>
|
||||
<li>截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>
|
||||
<li>答题时间:<%= ma.course_message.time == 0 ? '无限制' : ma.course_message.time.to_s + '分钟' %></li>
|
||||
<li>答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %></li>
|
||||
<p>请及时完成课程测验,辛苦啦!</p>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#coding=utf-8
|
||||
|
||||
#需要在0点以后执行
|
||||
namespace :exercise_deadline_warn do
|
||||
desc "exercise deadline warn"
|
||||
task :deadline_warn => :environment do
|
||||
|
|
Loading…
Reference in New Issue