作品列表报500

This commit is contained in:
cxt 2018-03-07 17:00:43 +08:00
parent 4dbeda8c21
commit 1396a56e06
1 changed files with 1 additions and 1 deletions

View File

@ -4025,7 +4025,7 @@ def get_hw_index(hw,is_teacher)
homeworks = hw.course.homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
end
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty?
index = hw_ids.index(hw.id)
index = hw_ids ? (hw_ids.index(hw.id).nil? ? hw_ids.count : hw_ids.index(hw.id)) : 0
return index
end