upgrades
This commit is contained in:
parent
e33dee9a45
commit
ebb90e12b7
|
@ -7,8 +7,9 @@ class MemberCounselorsController < CUserController
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
pcity = nil
|
pcity = nil
|
||||||
page = Page.where(:page_id => params[:page_id]).first
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
|
schoolmembers = HpsMember.where(:user_type => 0).pluck(:id)
|
||||||
cities = HpsCity.all.collect do |city|
|
cities = HpsCity.all.collect do |city|
|
||||||
total = city.hps_files.count
|
total = city.hps_files.where(:hps_member_id.in => schoolmembers).count
|
||||||
pcity = city if idx == 0
|
pcity = city if idx == 0
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
{
|
{
|
||||||
|
@ -22,15 +23,15 @@ class MemberCounselorsController < CUserController
|
||||||
end
|
end
|
||||||
total = 0
|
total = 0
|
||||||
schools = pcity.hps_schools.collect do |school|
|
schools = pcity.hps_schools.collect do |school|
|
||||||
members = HpsMember.where(:hps_school_id => school.id.to_s).pluck(:id)
|
members = HpsMember.where(:hps_school_id => school.id.to_s).pluck(:id)
|
||||||
count = HpsFile.where(:hps_member_id.in => members).count
|
count = HpsFile.where(:hps_member_id.in => members).count
|
||||||
total = count + total
|
total = count + total
|
||||||
{
|
{
|
||||||
"name" => school.name,
|
"name" => school.name,
|
||||||
"url_to_show" => OrbitHelper.url_to_show(school.to_param) + "?method=proposals",
|
"url_to_show" => OrbitHelper.url_to_show(school.to_param) + "?method=proposals",
|
||||||
"count" => count
|
"count" => count
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"cities" => cities,
|
"cities" => cities,
|
||||||
"schools" => schools,
|
"schools" => schools,
|
||||||
|
@ -43,7 +44,17 @@ class MemberCounselorsController < CUserController
|
||||||
school = HpsSchool.where(:uid => params[:uid]).first
|
school = HpsSchool.where(:uid => params[:uid]).first
|
||||||
members = HpsMember.where(:hps_school_id => school.id.to_s)
|
members = HpsMember.where(:hps_school_id => school.id.to_s)
|
||||||
page = Page.where(:page_id => params[:page_id]).first
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
|
schoolmembers = HpsMember.where(:user_type => 0).pluck(:id)
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
|
cities = HpsCity.all.collect do |city|
|
||||||
|
total = city.hps_files.where(:hps_member_id.in => schoolmembers).count
|
||||||
|
{
|
||||||
|
"name" => city.name,
|
||||||
|
"total" => total,
|
||||||
|
"url" => "/" + I18n.locale.to_s + page.url + "?city_id=#{city.id.to_s}"
|
||||||
|
}
|
||||||
|
end
|
||||||
members.each do |member|
|
members.each do |member|
|
||||||
member.hps_files.desc(:created_at).each do |file|
|
member.hps_files.desc(:created_at).each do |file|
|
||||||
files << {
|
files << {
|
||||||
|
@ -56,6 +67,7 @@ class MemberCounselorsController < CUserController
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"files" => files,
|
"files" => files,
|
||||||
|
"cities" => cities,
|
||||||
"data" => {
|
"data" => {
|
||||||
"back-url" => "/" + I18n.locale.to_s + page.url
|
"back-url" => "/" + I18n.locale.to_s + page.url
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,11 @@ class HpsMember
|
||||||
def get_user_type
|
def get_user_type
|
||||||
case self.user_type
|
case self.user_type
|
||||||
when 0
|
when 0
|
||||||
I18n.t("member_counselor.type1")
|
I18n.t("member_counselor.type1") #school
|
||||||
when 1
|
when 1
|
||||||
I18n.t("member_counselor.type2")
|
I18n.t("member_counselor.type2") #govt
|
||||||
when 2
|
when 2
|
||||||
I18n.t("member_counselor.type3")
|
I18n.t("member_counselor.type3") #counselor
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue