导入作业:公共题库中显示的却是我的题库,我的题库中显示的却是公共题库

This commit is contained in:
cxt 2016-07-18 14:43:47 +08:00
parent 9e5e7a75b0
commit 8e3488132b
2 changed files with 5 additions and 5 deletions

View File

@ -709,9 +709,9 @@ class UsersController < ApplicationController
@user = User.current
@select_course = params[:select_course] ? 1 : 0
#@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
courses = @user.courses.where("is_delete = 1")
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}")
@type = params[:type]
@limit = 15
@is_remote = true

View File

@ -1,8 +1,8 @@
<div class="w985"> <a href="javascript:void(0);" class="popup-close" onclick="hideModal()"></a>
<div class="f16 fb fontBlue mb10">选用题库中的题目</div>
<div class="subject-list fl mr10">
<a href="<%= user_homework_type_user_path(@user,:is_import => 1) %>" id="public_homeworks_choose" class="resource-tab resource-tab-active fl" data-remote="true">公共题库</a>
<a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 1) %>" id="user_homeworks_choose" class="resource-tab fl" data-remote="true">我的题库</a>
<a href="<%= user_homework_type_user_path(@user,:is_import => 1) %>" id="public_homeworks_choose" class="resource-tab resource-tab-active fl" data-remote="true">我的题库</a>
<a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 1) %>" id="user_homeworks_choose" class="resource-tab fl" data-remote="true">公共题库</a>
<!--<a href="<%#= user_homework_type_user_path(@user,:type=>'3',:is_import => 1) %>" id="apply_homeworks_choose" class="resource-tab fl" data-remote="true">申请题库</a>-->
<div id="homework_search_input">