Merge branch 'cxt_course' into develop

This commit is contained in:
cxt 2016-08-09 15:24:07 +08:00
commit 739edd68bf
3 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,7 @@ class AdminController < ApplicationController
course = Course.where("id = #{params[:course_id].to_i}").first
unless course.nil?
course.update_column('syllabus_id', params[:syllabus_id].to_i)
logger.error "update_syllabus_id: admin_controller/select_scourse_syllabus"
@flag = true
end
end
@ -83,6 +84,7 @@ class AdminController < ApplicationController
syllabus.description = Message.where("id = 19412").first.nil? ? nil : Message.where("id = 19412").first.content
if syllabus.save
course.update_column('syllabus_id', syllabus.id)
logger.error "update_syllabus_id: admin_controller/create_syllabus"
@flag = params[:flag].to_i
@course = course
respond_to do |format|

View File

@ -353,6 +353,7 @@ class CoursesService
#@course.password = params[:course][:password]
@course.tea_id = current_user.id
@course.syllabus_id = params[:syllabus_id].to_i
logger.error "update_syllabus_id: courses_service/create_course"
@course.term = params[:term]
@course.time = params[:time]
@course.end_term = params[:end_term]
@ -412,6 +413,7 @@ class CoursesService
#course.safe_attributes = params[:course]
#course.password = params[:course][:password]
course.syllabus_id = params[:syllabus_id].to_i
logger.error "update_syllabus_id: courses_service/edit_course"
course.time = params[:time]
course.term = params[:term]
course.end_time = params[:end_time]

View File

@ -86,12 +86,14 @@ class SyllabusesService
courses.each do |course|
if ::Course === course
course.syllabus_id = sy.id
logger.error "update_syllabus_id: syllabus_service/create"
course.save!
send_wechat_create_class_notice user,course
elsif Hash === course
c = ::Course.new(course)
c.tea_id = user.id
c.syllabus_id = sy.id
logger.error "update_syllabus_id: syllabus_service/create"
c.update_default_value
c.is_public = 0
c.save!
@ -136,6 +138,7 @@ class SyllabusesService
course.name = c
course.tea_id = user.id
course.syllabus_id = sy.id
logger.error "update_syllabus_id: syllabus_service/edit"
course.update_default_value
course.is_public = 0
course.save!