From 0719eea4ec6fd65f3f7d14dcb792457887b94689 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Mon, 22 Jul 2019 09:59:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?homework=5Fcommon=20=E5=AF=BC=E5=87=BAzip?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/graduation_tasks_controller.rb | 2 +- app/controllers/homework_commons_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index 6bf3d2f8a..8ee803609 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 == -2 ? "500M" : "无附件可下载") end end end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 052db3e4f..0d30056ac 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 == -2 ? "500M" : "无附件可下载") end end end From 2719cf29f3219f3d835c57f68d4824f4ee082966 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Mon, 22 Jul 2019 10:10:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?issue=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 6 +++--- app/controllers/graduation_tasks_controller.rb | 2 +- app/controllers/homework_commons_controller.rb | 2 +- app/views/users/courses/shared/_course.json.jbuilder | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) 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 8ee803609..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 - normal_status(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 0d30056ac..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 - normal_status(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)