协助老师显示数据更改

schedule_job
daiao 5 years ago
parent 7270e2ee5a
commit bb80e8bdb9

@ -1306,7 +1306,7 @@ class CoursesController < ApplicationController
@user = current_user
@switch_student = Course::BUSINESS < @user_course_identity && @user_course_identity < Course::STUDENT
@is_student = @user_course_identity == Course::STUDENT
@teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..2]
@teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..3]
@course.increment!(:visits)
end

@ -76,7 +76,7 @@ class Weapps::CoursesController < Weapps::BaseController
def show
@course = current_course
@current_user = current_user
@teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..2]
@teacher_users = @course.teacher_users.where.not(id: @course.tea_id).map(&:real_name)[0..3]
end
def shixun_homework_category

@ -13,7 +13,7 @@ json.courses @courses do |course|
json.is_end course.is_end
json.first_category_url module_url(course.none_hidden_course_modules.first, course)
json.excellent course.excellent
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..3] # 取前4名老师
end
json.courses_count @courses_count

@ -7,7 +7,7 @@ json.homework_commons_count get_tasks_count course
json.attachments_count course.attachments.count
json.visits course.visits
json.school course.school&.name
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..3] # 取前4名老师
json.first_category_url module_url(course.course_modules.where(hidden: 0).order(position: :desc).first, course)

@ -26,6 +26,6 @@ json.courses @courses.each do |course|
course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first
json.sticky course_member.sticky
json.course_identity current_user.course_identity(course)
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..2] # 取前3名老师
json.teacher_users course.teacher_users.select{|u| u.id != course.tea_id }.map(&:real_name)[0..3] # 取前4名老师
end

Loading…
Cancel
Save