shield_project_ids=ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id)
shield_project_ids=ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids=ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id)
shield_course_ids=ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id)
@org_activities=OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page]||1).per(10)
@org_activities=OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page]||1).per(10)
shield_project_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_project_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
shield_course_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
@ -175,7 +180,7 @@ class OrganizationsController < ApplicationController
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comptec").first:OrgSubfield.find(params[:org_subfield_id])
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comptec").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
@type=params[:type]
if@type=="courses"||@type.nil?
if@type.blank?
@org_teachers=User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
@org_teachers=User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
@type=params[:type]
if@type=="courses"||@type.nil?
if@type.blank?
@org_students=User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
@org_students=User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comppro").first:OrgSubfield.find(params[:org_subfield_id])
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comppro").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
@type=params[:type]
if@type.nil?
if@type.blank?
@containers=Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
@containers=Project.find_by_sql("select p.*, (select count(*) from forge_activities where forge_activities.project_id = p.id) as project_count
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
@type=params[:type]
if@type.nil?
if@type.blank?
@containers=Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
@containers=Course.find_by_sql("select c.*, (select count(*) from course_activities where course_activities.course_id = c.id) as course_count
shield_project_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
@ -166,7 +166,7 @@ class UsersController < ApplicationController
messages=MessageAll.where("(user_id =? and message_type !=?) or message_type =?",@user.id,"SystemMessage","SystemMessage").includes(:message).order("created_at desc")
messages=MessageAll.where("(user_id =? and message_type !=?) or message_type =?",@user.id,"SystemMessage","SystemMessage").includes(:message).order("created_at desc")
org_acts=OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc')
org_acts=OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{org_subfield.id})").order('updated_at desc')