diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index b937d293d..1cee38816 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -62,13 +62,13 @@ class CoursesController < ApplicationController if @order == "mine" tip_exception(401, "..") unless current_user.logged? @courses = Course.joins(:course_members) - .where("is_delete = 0 AND is_hidden = 0 AND course_members.user_id = ?", @user.id) + .where("is_delete = 0 AND is_hidden = 0 AND course_members.user_id = ?", @user.id).distinct elsif @order == "created_at" # REDO:Extension - @courses = Course.where(is_delete: 0, is_hidden: 0, is_end: 0) + @courses = Course.where(is_delete: 0, is_hidden: 0, is_end: 0).distinct else # REDO:Extension - @courses = Course.where(is_delete: 0, is_hidden: 0) + @courses = Course.where(is_delete: 0, is_hidden: 0).distinct end # 根据搜索关键字进一步筛选 diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index 6bf3d2f8a..ab99e8d86 100644 --- a/app/controllers/graduation_tasks_controller.rb +++ b/app/controllers/graduation_tasks_controller.rb @@ -156,7 +156,7 @@ class GraduationTasksController < ApplicationController } end else - tip_exception(status == -2 ? "500M" : "无附件可下载") + normal_status(status,status == -2 ? "500M" : "无附件可下载") end end end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 052db3e4f..8fab8dad3 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -228,7 +228,7 @@ class HomeworkCommonsController < ApplicationController } end else - tip_exception(status == -2 ? "500M" : "无附件可下载") + normal_status(status, status == -2 ? "500M" : "无附件可下载") end end end diff --git a/app/views/users/courses/shared/_course.json.jbuilder b/app/views/users/courses/shared/_course.json.jbuilder index 629f47264..e917033da 100644 --- a/app/views/users/courses/shared/_course.json.jbuilder +++ b/app/views/users/courses/shared/_course.json.jbuilder @@ -1,7 +1,9 @@ json.id course.id json.name course.name -json.members_count course.members_count -json.homework_commons_count course.homework_commons_count +# json.members_count course.members_count +json.members_count course.course_members_count +# json.homework_commons_count course.homework_commons_count +json.homework_commons_count get_tasks_count course json.attachments_count course.attachments.count json.first_category_url module_url(course.course_modules.where(hidden: 0).order(position: :desc).first, course)