Merge branch 'dev_course' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_course

dev_course
SylorHuang 6 years ago
commit 0be2c149a4

@ -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)

@ -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

@ -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

@ -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'

Loading…
Cancel
Save