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)
@ -102,7 +107,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])
@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
@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]
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
@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]
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
@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]
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
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)
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')