From 82cc18596c9f9488fe60d4befefe8f5dc450c8ee Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jun 2019 09:17:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E9=A2=98=E8=AF=A6=E6=83=85=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E7=94=A8=E6=88=B7=E6=98=AF=E5=90=A6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=BA=86=E5=85=B6=E4=BB=96=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/graduation_topics_controller.rb | 4 ++++ app/views/graduation_topics/show.json.jbuilder | 1 + 2 files changed, 5 insertions(+) diff --git a/app/controllers/graduation_topics_controller.rb b/app/controllers/graduation_topics_controller.rb index 36f51ce6e..366b6d9ca 100644 --- a/app/controllers/graduation_topics_controller.rb +++ b/app/controllers/graduation_topics_controller.rb @@ -45,6 +45,10 @@ class GraduationTopicsController < ApplicationController end ## 分页参数 @current_user = current_user + user_graduation_topics = @course.student_graduation_topics.where(user_id: current_user.id, + status: [0, 1], + graduation_topic_id: @graduation_topic.pluck(:id)) + @user_selected = user_graduation_topics.size > 0 page = params[:page] || 1 limit = params[:limit] || 50 @users_count = @student_graduation_topics.try(:count).to_i diff --git a/app/views/graduation_topics/show.json.jbuilder b/app/views/graduation_topics/show.json.jbuilder index a75ac5240..87fcc87aa 100644 --- a/app/views/graduation_topics/show.json.jbuilder +++ b/app/views/graduation_topics/show.json.jbuilder @@ -8,6 +8,7 @@ json.users_count @users_count json.course_identity @current_user.course_identity(@course) json.user_selected_topic @graduation_topic.user_status(current_user.id) json.group_list @course.teacher_group(current_user.id) +json.user_selected @user_selected # 列表数据 json.users_list do