From 7ffd21858a9c136294f5099a54e0bd9f560170c4 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 20 Jun 2019 18:41:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index df23b6b25..4a34d9039 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -50,9 +50,11 @@ class CoursesController < ApplicationController order_str = @order != "course_members_count" && @order != "created_at" ? "updated_at" : @order if @order == "all" - # @course = Course.where(is_delete: 0, is_hidden: 0).find_by_sql("select c.name, c.id, s.name, u.last_name from - # courses c, users u, user_extensions ue, schools s where c.is_delete=0 and c.tea_id=u.id and - # u.id=ue.user_id and ue.school_id=s.id limit 10;") + # @course = Course.where(is_delete: 0, is_hidden: 0).select("select c.name, c.id, s.name, u.login, ifnull(concat(u.lastname,u.firstname), + # u.login), s.name from courses c, users u, user_extensions ue, schools s where c.is_delete=0 and + # c.tea_id=u.id and u.id=ue.user_id and ue.school_id=s.id") + + # @courses = Course.where(is_delete: 0, is_hidden: 0).includes([teacher: :user_extension], :school) @courses = Course.where(is_delete: 0, is_hidden: 0).select("courses.id, courses.tea_id, courses.name, courses.exercises_count, courses.polls_count, courses.is_public, courses.is_end, courses.visits, courses.course_members_count,courses.homework_commons_count,(SELECT MAX(created_at) From 82edc4c9a9d18a5939fa1f4ffbc0900f504ff076 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 20 Jun 2019 18:45:01 +0800 Subject: [PATCH 2/3] configuration --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 8f1d3aebf..baa0011f2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,7 @@ module Educoderplus # the framework and any gems in your application. # # - config.educoder = config_for(:configuration) + # config.educoder = config_for(:configuration) config.active_record.default_timezone = :local config.time_zone = 'Beijing' From 4519abbce477d934b88aa795eaad657c61ef50e6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 20 Jun 2019 18:50:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=AF=95=E8=AE=BE=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E5=8F=8C=E9=87=8D=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=E7=9A=84=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/graduation_tasks_controller.rb | 4 ++-- app/models/course.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index d95716c9b..435dbd4ed 100644 --- a/app/controllers/graduation_tasks_controller.rb +++ b/app/controllers/graduation_tasks_controller.rb @@ -66,7 +66,7 @@ class GraduationTasksController < ApplicationController @course.teacher_group_user_ids(current_user.id) else course_group_id = @course.course_member(current_user.id).course_group_id - @course.course_members.where(course_group_id: course_group_id).pluck(:user_id) + @course.students.where(course_group_id: course_group_id).pluck(:user_id) end @work_list = @task.graduation_works.where(user_id: user_ids).includes(user: [:user_extension]) @@ -89,7 +89,7 @@ class GraduationTasksController < ApplicationController # 分班情况 unless params[:course_group].blank? - group_user_ids = @course.course_members.where(course_group_id: params[:course_group]).pluck(:user_id) + group_user_ids = @course.students.where(course_group_id: params[:course_group]).pluck(:user_id) # 有分组只可能是老师身份查看列表 @work_list = @work_list.where(user_id: group_user_ids) end diff --git a/app/models/course.rb b/app/models/course.rb index dd2248d7c..30460b49a 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -139,9 +139,9 @@ class Course < ApplicationRecord def teacher_group_user_ids user_id teachers = teacher_course_groups.where(user_id: user_id) if teachers.exists? - course_members.where(course_group_id: teachers.pluck(:course_group_id)).pluck(:user_id) + students.where(course_group_id: teachers.pluck(:course_group_id)).pluck(:user_id) else - course_members.where(role: 4).pluck(:user_id) + students.pluck(:user_id) end end