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

dev_course
jingquan huang 6 years ago
commit 7172640f35

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

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

@ -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" ? "教师" : "助教"

@ -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 # todo: 这块可以改成只显示实训的平均分,不用每次都去取每种星的分数了。
# 用于是否显示导航栏中的'背景知识'
json.propaedeutics shixun.propaedeutics.present? ? true : false

@ -0,0 +1,5 @@
class MigrateCourseModuleActivity < ActiveRecord::Migration[5.2]
def change
CourseModule.where(module_type: 'activity').update_all(hidden: 1)
end
end
Loading…
Cancel
Save