Back to Parent

def determine_PD_info x
        
        match_project_NAMEADDR = []
        match_project_BESTSTAT = []
        match_project_DBIDESC = []

        match_project_AFFORDABLENET = []

        #match_project_Longitude = []
        #match_project_Latitude = []

        sum_match_project = 0
        match_project_construction = 0
        match_project_approved = 0
        match_project_underreview = 0

        random_n = rand(sum_match_project)
        random_proj_NAMEADDR = ""
        random_proj_BESTSTAT = ""
        random_proj_DBIDESC = ""

        # THIS CURRENTLY DOESN'T WORK 

        file= File.read('SF_Development_Pipeline_2018_Q2_AWedit.json')
        all_projects=JSON.parse(file)

            all_projects.each do |row|
                if row["NAMEADDR"]!=0
                    if row["PD"].to_s == session["PD"]  
                        match_project_NAMEADDR.push(row["NAMEADDR"])                
                        match_project_BESTSTAT.push(row["BESTSTAT"])
                        match_project_DBIDESC.push(row["DBIDESC"])
                    end
                end
             end

        
        sum_match_project = match_project_NAMEADDR.count
        #sum_affordablenet = match_project_AFFORDABLENET.map(&:to_i).reduce(:+)
        match_project_construction = match_project_BESTSTAT.count("CONSTRUCTION")
        match_project_approved = match_project_BESTSTAT.count("BP APPROVED") + match_project_BESTSTAT.count("PL APPROVED") + match_project_BESTSTAT.count("PL Approved")
        match_project_underreview = match_project_BESTSTAT.count - match_project_construction - match_project_approved

        # ================= print result – start ================
        "Found it! " + x +" is actually part of the larger " + session["PD_SIMP"] + " Planning District, which has " + match_project_construction.to_s + " projects under construction, " + match_project_approved.to_s + " approved, and " + match_project_underreview.to_s + " under review."
        
        # ================= print result – end =================

end
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0