Ucloud测试版:点击发送的在线测试,页面显示500

This commit is contained in:
cxt 2017-03-03 18:43:26 +08:00
parent 0de116c0af
commit 1fb0160ae5
2 changed files with 8 additions and 4 deletions

View File

@ -484,7 +484,11 @@ class ExerciseController < ApplicationController
end
=end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
if @is_teacher
@all_exercises = @course.exercises.order("created_at desc")
else
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
end
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
@exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time <= Time.now)

View File

@ -99,9 +99,9 @@
<% if @exercise.exercise_status == 1 %>
<div class="fontGrey2 db fl ml10">发布时间:<%= format_time @exercise.publish_time %></div>
<% end %>
<% end_time = @exercise.end_time.to_time.to_i %>
<% if end_time > Time.now.to_i %>
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
<% if @exercise.end_time && @exercise.end_time.to_time.to_i > Time.now.to_i %>
<% end_time = @exercise.end_time.to_time.to_i %>
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>