“我的作业”中有挂起的作业时会报500

This commit is contained in:
cxt 2016-08-11 14:44:43 +08:00
parent bae0562b97
commit 80b8fc4444
1 changed files with 1 additions and 1 deletions

View File

@ -1534,7 +1534,7 @@ class UsersController < ApplicationController
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
@receive_homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc").limit(5)
if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.publish_time > @receive_homeworks.first.publish_time)
if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.created_at > @receive_homeworks.first.created_at)
@manage_pre = true
else
@manage_pre = false