From 75fae4b3cc3c597851f0ce94fee2d7b8193ab323 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jun 2019 14:13:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=84=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_top.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shixuns/_top.json.jbuilder b/app/views/shixuns/_top.json.jbuilder index 7c006cccf..bd23365e5 100644 --- a/app/views/shixuns/_top.json.jbuilder +++ b/app/views/shixuns/_top.json.jbuilder @@ -13,7 +13,7 @@ json.name shixun.name json.stu_num shixun.myshixuns_count json.experience shixun.all_score json.diffcult diff_to_s(shixun.trainee) -json.score_info shixun.averge_star +json.score_info shixun.shixun_preference_info # 用于是否显示导航栏中的'背景知识' json.propaedeutics shixun.propaedeutics.present? ? true : false From aab6a3f00d8859b80934150f2c518990937441b5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jun 2019 14:19:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_top.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shixuns/_top.json.jbuilder b/app/views/shixuns/_top.json.jbuilder index bd23365e5..f741e9021 100644 --- a/app/views/shixuns/_top.json.jbuilder +++ b/app/views/shixuns/_top.json.jbuilder @@ -13,7 +13,7 @@ json.name shixun.name json.stu_num shixun.myshixuns_count json.experience shixun.all_score json.diffcult diff_to_s(shixun.trainee) -json.score_info shixun.shixun_preference_info +json.score_info shixun.shixun_preference_info # todo: 这块可以改成只显示实训的平均分,不用每次都去取每种星的分数了。 # 用于是否显示导航栏中的'背景知识' json.propaedeutics shixun.propaedeutics.present? ? true : false From b1b9d7103bfc26a2adb420c1934c18063aa65bc9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 21 Jun 2019 14:32:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E4=BC=98=E5=8C=96=E3=80=81=E8=AF=BE=E5=A0=82=E7=9A=84?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 6 +++--- app/models/homework_common.rb | 3 ++- db/migrate/20190621062948_migrate_course_module_activity.rb | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20190621062948_migrate_course_module_activity.rb diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index d3ece9feb..c0d72e1ee 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -90,13 +90,13 @@ class HomeworkCommonsController < ApplicationController if @homework_type == 4 if @user_course_identity == Course::STUDENT - @homework_commons = @homework_commons.includes(:homework_detail_manual, :homework_group_settings, :shixuns, + @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns, student_works: [myshixun: [:games]]) else - @homework_commons = @homework_commons.includes(:homework_detail_manual, :homework_group_settings, :shixuns, :student_works) + @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns, :student_works) end else - @homework_commons = @homework_commons.includes(:homework_detail_manual, :homework_group_settings, :homework_detail_group, + @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_detail_group, :student_works) end end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 74d85e2ae..d67b6e0fd 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -2,6 +2,7 @@ class HomeworkCommon < ApplicationRecord # homework_type 1:普通作业 2:编程作业(弃用) 3:分组作业 4:实训作业 enum homework_type: { normal: 1, program: 2, group: 3, practice: 4 }, _suffix: true has_many :homework_group_settings, dependent: :destroy + has_many :published_settings, -> { group_published }, class_name: "HomeworkGroupSetting" has_many :student_works, -> { where("is_delete != 1") } has_one :homework_detail_manual, dependent: :destroy @@ -78,7 +79,7 @@ class HomeworkCommon < ApplicationRecord def all_works student_works = self.unified_setting ? self.student_works : self.student_works.where(user_id: self.course.students.where( - course_group_id: self.homework_group_settings.group_published.pluck(:course_group_id)). + course_group_id: self.published_settings.pluck(:course_group_id)). pluck(:user_id)) end diff --git a/db/migrate/20190621062948_migrate_course_module_activity.rb b/db/migrate/20190621062948_migrate_course_module_activity.rb new file mode 100644 index 000000000..1fa1ea112 --- /dev/null +++ b/db/migrate/20190621062948_migrate_course_module_activity.rb @@ -0,0 +1,5 @@ +class MigrateCourseModuleActivity < ActiveRecord::Migration[5.2] + def change + CourseModule.where(module_type: 'activity').update_all(hidden: 1) + end +end \ No newline at end of file From a67bb19f496231ecc66413e9864a80bbec96062e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 21 Jun 2019 14:43:58 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=94=A8=E6=88=B7url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/teachers.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/teachers.json.jbuilder b/app/views/courses/teachers.json.jbuilder index 25df05097..1be1ce16c 100644 --- a/app/views/courses/teachers.json.jbuilder +++ b/app/views/courses/teachers.json.jbuilder @@ -2,7 +2,7 @@ json.teacher_list do json.array! @teacher_list do |teacher| json.course_member_id teacher.id json.name teacher.user.real_name - json.name_link user_path(teacher.user.login) + json.name_link user_path(teacher.user) json.login teacher.user.login json.user_id teacher.user.id json.role teacher.role == "CREATOR" ? "管理员" : teacher.role == "PROFESSOR" ? "教师" : "助教"