mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 11:43:05 +08:00
init project
This commit is contained in:
16
app/controllers/users/courses_controller.rb
Normal file
16
app/controllers/users/courses_controller.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class Users::CoursesController < Users::BaseController
|
||||
def index
|
||||
courses = Users::CourseService.new(observed_user, query_params).call
|
||||
|
||||
courses = courses.where(id: current_laboratory.all_courses)
|
||||
|
||||
@count = courses.count
|
||||
@courses = paginate(courses.includes(teacher: { user_extension: :school }), special: observed_user.is_teacher?)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def query_params
|
||||
params.permit(:category, :status, :sort_direction)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user