我的题库显示我的所有作业
This commit is contained in:
parent
fc3df1c26f
commit
a3011c319b
|
@ -599,7 +599,7 @@ class UsersController < ApplicationController
|
||||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||||
courses = @user.courses.where("is_delete = 1")
|
courses = @user.courses.where("is_delete = 1")
|
||||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
||||||
elsif params[:type] == "2" #公共题库
|
elsif params[:type] == "2" #公共题库
|
||||||
visible_course = Course.where("is_delete = 0")
|
visible_course = Course.where("is_delete = 0")
|
||||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||||
|
|
Loading…
Reference in New Issue