diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index aaf24eadb..c1c0336be 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -26,12 +26,14 @@ class CoursesController < ApplicationController :base_info, :get_historical_courses, :create_group_by_importing_file, :attahcment_category_list,:export_member_scores_excel, :duplicate_course, :switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course, - :informs, :update_informs, :join_excellent_course, :online_learning] + :informs, :update_informs, :join_excellent_course, :online_learning, + :update_task_position, :tasks_list] before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate, :transfer_to_course_group, :delete_from_course, :search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher] before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin, - :set_course_group, :create_group_by_importing_file, :update_informs] + :set_course_group, :create_group_by_importing_file, :update_informs, + :update_task_position, :tasks_list] before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group, :change_course_teacher, :export_member_scores_excel, :course_group_list, :teacher_application_review, :apply_teachers, :delete_course_teacher] @@ -1115,6 +1117,14 @@ class CoursesController < ApplicationController render_ok(count: count, courses: courses.select(:id, :name).as_json) end + def tasks_list + + end + + def update_task_position + + end + private # Use callbacks to share common setup or constraints between actions. diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index e510ca666..ae6ecfd5d 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -48,9 +48,9 @@ class HomeworkCommon < ApplicationRecord scope :search_homework_type, lambda {|num| where(homework_type:num)} scope :unified_setting, -> {where("unified_setting = ? ", 1)} - scope :normals, -> {where(homework_type: %i[normal])} - scope :groups, -> {where(homework_type: %i[group])} - scope :practices, -> {where(homework_type: %i[practice])} + scope :normals, -> {where(homework_type: %i[normal]).order("position desc")} + scope :groups, -> {where(homework_type: %i[group]).order("position desc")} + scope :practices, -> {where(homework_type: %i[practice]).order("position desc")} # 是否显示参考答案 def view_answer identity, user_id diff --git a/config/routes.rb b/config/routes.rb index 2ecd6502e..7577f3afb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -351,6 +351,8 @@ Rails.application.routes.draw do post 'update_informs' get 'online_learning' post 'join_excellent_course' + get 'tasks_list' + post 'update_task_position' end collection do