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

dev_course
cxt 6 years ago
commit 0f2abdab28

@ -436,7 +436,7 @@ class ExercisesController < ApplicationController
exercise_status = @exercise.get_exercise_status(current_user.id)
if exercise_status == 1 && (course_group_ids - [0]).count > 0 # 试卷未发布且老师的分班大于1 ,才可以修改统一设置,否则按试卷默认的来处理
if exercise_status == 1 && course_group_ids.size > 0 # 试卷未发布且老师的分班大于1 ,才可以修改统一设置,否则按试卷默认的来处理
unified_setting = params[:unified_setting]
else
unified_setting = @exercise.unified_setting
@ -450,7 +450,7 @@ class ExercisesController < ApplicationController
answer_open = params[:answer_open] ? true : false #答案是否公开
# 统一设置或者分班为0则更新试卷并删除试卷分组
if unified_setting || (course_group_ids.count == 0)
if unified_setting || (course_group_ids.size == 0)
params_publish_time = params[:publish_time].blank? ? nil : params[:publish_time].to_time
params_end_time = nil
if params[:end_time].blank?
@ -798,12 +798,13 @@ class ExercisesController < ApplicationController
if exercise_status == 2 #跳过已截止的或未发布的
g_course = params[:group_ids]
if g_course.present?
user_course_groups= @course.teacher_course_groups.get_user_groups(current_user.id)
if user_course_groups.present?
teacher_course_group_ids = user_course_groups.pluck(:course_group_id)
else
teacher_course_group_ids = @course.course_groups.pluck(:id)
end
# user_course_groups= @course.teacher_course_groups.get_user_groups(current_user.id)
# if user_course_groups.present?
# teacher_course_group_ids = user_course_groups.pluck(:course_group_id)
# else
# teacher_course_group_ids = @course.course_groups.pluck(:id)
# end
teacher_course_group_ids = @course.charge_group_ids(current_user)
if g_course.map(&:to_i).sort == teacher_course_group_ids.sort #开始为统一设置
exercise.exercise_group_settings.destroy_all
new_ex_status = set_exercise_status(exercise.publish_time,Time.now)

@ -691,7 +691,7 @@ class PollsController < ApplicationController
course_group_ids = @course.charge_group_ids(current_user) #当前老师的班级id数组
poll_status = @poll.get_poll_status(current_user.id)
if poll_status == 1 && (course_group_ids - [0]).count > 0 # 问卷未发布且老师的分班大于1 才可以修改统一设置否则按poll默认的来处理
if poll_status == 1 && course_group_ids.size > 0 # 问卷未发布且老师的分班大于1 才可以修改统一设置否则按poll默认的来处理
unified_setting = params[:unified_setting]
else
unified_setting = @poll.unified_setting

@ -1,8 +1,12 @@
class SchoolsController < ApplicationController
def school_list
schools = School.all
search = params[:search].to_s.strip
if search.present?
schools = schools.where('name Like ?', "%#{search}%")
end
def school_list
q = params[:search] ? params[:search].strip : ""
@schools = School.where("name like ?", "%#{q}%").pluck(:name)
render_ok(school_names: schools.pluck(:name))
end
end

@ -121,7 +121,7 @@ class Course < ApplicationRecord
end
#当前老师的班级id
def teacher_course_group_ids(user_id)
def teacher_course_ids(user_id)
course_teacher_member = teacher_course_groups.get_user_groups(user_id) #获取当前老师的分班
if course_teacher_member.blank?
if none_group_count > 0 #有未分班的,则发布到未发布分班

@ -66,7 +66,7 @@ class Exercise < ApplicationRecord
#当前用户已发布的班级id和试卷分组已发布的班级id的交集
def common_published_ids(user_id)
current_user_groups = course.teacher_course_group_ids(user_id)
current_user_groups = course.teacher_course_ids(user_id)
if unified_setting
if course.none_group_count > 0 #有未分班的,则发布到未发布分班
un_group_ids = [0]

@ -62,7 +62,7 @@ class Poll < ApplicationRecord
#当前用户已发布的班级id和试卷分组已发布的班级id的交集
def poll_published_ids(user_id)
current_user_groups = course.teacher_course_group_ids(user_id)
current_user_groups = course.teacher_course_ids(user_id)
if unified_setting
if course.none_group_count > 0 #有未分班的,则发布到未发布
un_group_ids = [0]

@ -1 +0,0 @@
json.shools_name @schools

@ -34,9 +34,9 @@ class SchoolSelect extends Component{
}
})
.then((response) => {
if (response.data.shools_name) {
if (response.data.school_names) {
if (currentValue === value) {
callback(response.data.shools_name);
callback(response.data.school_names);
}
}
})

@ -314,7 +314,7 @@ class CoursesNew extends Component {
}
}).then((result)=>{
this.setState({
searchlistscholl:result.data.shools_name,
searchlistscholl:result.data.school_names,
scholl:value
})
this.props.form.setFieldsValue({

Loading…
Cancel
Save