学院统计的课堂调整

pre_develop
cxt 6 years ago
parent c49f381345
commit d48ec8974e

@ -131,7 +131,7 @@ class CollegesController < ApplicationController
(select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count, (select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count,
c.tea_id, c.name, c.is_end, c.tea_id, c.name, c.is_end,
(SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time (SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time
FROM `courses` c WHERE (c.school_id = #{@school.id} and c.is_delete = 0)") FROM `courses` c join user_extensions ue on ue.user_id = c.tea_id WHERE (ue.school_id = #{@school.id} and c.is_delete = 0)")
@courses.each do |course| @courses.each do |course|
course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join

@ -577,7 +577,7 @@ class CoursesController < ApplicationController
cha_member.member_roles.where("role_id = 10").first.destroy cha_member.member_roles.where("role_id = 10").first.destroy
StudentsForCourse.where(:course_id => @course.id, :student_id => cha_member.user_id).destroy_all StudentsForCourse.where(:course_id => @course.id, :student_id => cha_member.user_id).destroy_all
end end
@course.update_attributes(:tea_id => cha_member.user_id) @course.update_attributes(:tea_id => cha_member.user_id, :school_id => cha_member.user.try(:user_extensions).try(:school_id))
man_member.member_roles.first.update_attributes(:role_id => 9) man_member.member_roles.first.update_attributes(:role_id => 9)
course_act = CourseActivity.where(:course_id => @course.id, :course_act_id => @course.id, :course_act_type => 'Course').first course_act = CourseActivity.where(:course_id => @course.id, :course_act_id => @course.id, :course_act_type => 'Course').first
course_act.update_column('user_id', cha_member.user_id) course_act.update_column('user_id', cha_member.user_id)

Loading…
Cancel
Save