diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dd43e3e5b..d684240a4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -455,7 +455,7 @@ class UsersController < ApplicationController query = query.where("r.role_id in(3,7,9)") end query = query.where(Course.table_name+".is_public = 1") - # TODO or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) + # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) end if params[:lastid]!=nil && !params[:lastid].empty? diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb index 54f030e40..cf8679da6 100644 --- a/app/helpers/activities_helper.rb +++ b/app/helpers/activities_helper.rb @@ -46,26 +46,26 @@ module ActivitiesHelper def get_container_type(activity) #问卷 if activity.act_type == 'Poll' - return 'Course' + return ['Course',activity.act.polls_group_id] end #注册 if activity.act_type == 'Principal' - return 'Principal' + return ['Principal',activity.act.id] end #留言 if activity.act_type == 'JournalsForMessage' - return activity.act.jour.class.to_s + return [activity.act.jour_type,activity.act.jour_id] end # HomeworkCommon Issue Journal Message News if activity.act.respond_to?('course') && activity.act.course - return 'Course' + return ['Course',activity.act.course.id] end if activity.act.respond_to?('project') && activity.act.project - return 'Project' + return ['Project',activity.act.project.id] end # Contest Contestnotification - return 'Unknow' + return ['Unknow',0] end end diff --git a/app/models/activity.rb b/app/models/activity.rb index 22aa533d2..ff3f06ff6 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -13,6 +13,8 @@ class Activity < ActiveRecord::Base #helper :activities include ActivitiesHelper def set_container_type_val - self.activity_container_type = get_container_type(self) + container_type,container_id =get_container_type(self) + self.activity_container_type = container_type + self.activity_container_id = container_id end end diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index c0fe7421a..49322c19c 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -197,6 +197,30 @@ $(".subNav").click(function(){
+ <% if @center_flag %> +主讲老师:<%= item.teacher.show_name %>
-课程作业:<%= item.homework_commons.count %> 成员:<%= item.members.count %>
+课程作业:<%= item.homework_commons.count %> 学生:item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %>