diff --git a/devtracker.rb b/devtracker.rb index d84de4cf..49ed4533 100644 --- a/devtracker.rb +++ b/devtracker.rb @@ -304,6 +304,14 @@ # get the funded projects Count from the API fundedProjectsCount = get_funded_project_count(n) + + # get the R4D docs count from the R4D API + begin + r4dDocs = r4DApiDocFetch(n) || '' + r4dDocsCount = r4dDocs.count + rescue + r4dDocsCount = 0 + end erb :'projects/summary', :layout => :'layouts/layout', @@ -313,7 +321,8 @@ fundedProjectsCount: fundedProjectsCount, fundingProjectsCount: fundingProjectsCount, #projectBudget: projectBudget, - projectSectorGraphData: projectSectorGraphData + projectSectorGraphData: projectSectorGraphData, + r4dDocsCount: r4dDocsCount } end @@ -331,6 +340,14 @@ # get the funded projects Count from the API fundedProjectsCount = get_funded_project_count(n) + + # get the R4D docs count from the R4D API + begin + r4dDocs = r4DApiDocFetch(n) || '' + r4dDocsCount = r4dDocs.count + rescue + r4dDocsCount = 0 + end erb :'projects/documents', :layout => :'layouts/layout', @@ -338,7 +355,8 @@ project: project, countryOrRegion: countryOrRegion, fundedProjectsCount: fundedProjectsCount, - fundingProjectsCount: fundingProjectsCount + fundingProjectsCount: fundingProjectsCount, + r4dDocsCount: r4dDocsCount } end @@ -362,6 +380,14 @@ # get the funded projects Count from the API fundedProjectsCount = get_funded_project_count(n) + + # get the R4D docs count from the R4D API + begin + r4dDocs = r4DApiDocFetch(n) || '' + r4dDocsCount = r4dDocs.count + rescue + r4dDocsCount = 0 + end erb :'projects/transactions', :layout => :'layouts/layout', @@ -371,7 +397,8 @@ transactions: transactions, projectYearWiseBudgets: projectYearWiseBudgets, fundedProjectsCount: fundedProjectsCount, - fundingProjectsCount: fundingProjectsCount + fundingProjectsCount: fundingProjectsCount, + r4dDocsCount: r4dDocsCount } end @@ -391,6 +418,14 @@ # get the funded projects from the API fundedProjectsData = get_funded_project_details(n) + # get the R4D docs count from the R4D API + begin + r4dDocs = r4DApiDocFetch(n) || '' + r4dDocsCount = r4dDocs.count + rescue + r4dDocsCount = 0 + end + erb :'projects/partners', :layout => :'layouts/layout', :locals => { @@ -399,7 +434,46 @@ fundedProjects: fundedProjectsData['results'], fundedProjectsCount: fundedProjectsData['count'], fundingProjects: fundingProjects, - fundingProjectsCount: fundingProjectsData['count'] + fundingProjectsCount: fundingProjectsData['count'], + r4dDocsCount: r4dDocsCount + } +end + +#Project research page +get '/projects/:proj_id/research/?' do |n| + n = sanitize_input(n,"p") + # get the project data from the API + project = get_h1_project_details(n) + + #get the country/region data from the API + countryOrRegion = get_country_or_region(n) + + #get total project budget and spend Data + #projectBudget = get_project_budget(n) + + #get project sectorwise graph data + projectSectorGraphData = get_project_sector_graph_data(n) + + # get the funding projects Count from the API + fundingProjectsCount = get_funding_project_count(n) + + # get the funded projects Count from the API + fundedProjectsCount = get_funded_project_count(n) + + # get the R4D docs count from the R4D API + r4dDocs = r4DApiDocFetch(n) || '' + r4dDocsCount = r4dDocs.count + + erb :'projects/research', + :layout => :'layouts/layout', + :locals => { + project: project, + countryOrRegion: countryOrRegion, + fundedProjectsCount: fundedProjectsCount, + fundingProjectsCount: fundingProjectsCount, + projectSectorGraphData: projectSectorGraphData, + r4dDocsCount: r4dDocsCount, + r4dDocs: r4dDocs } end diff --git a/views/partials/_projects-header.html.erb b/views/partials/_projects-header.html.erb index 4034036b..e92d9444 100755 --- a/views/partials/_projects-header.html.erb +++ b/views/partials/_projects-header.html.erb @@ -37,11 +37,12 @@
This project has supported the following research projects and/or publications
<% r4dDocs.each do |s| %> diff --git a/views/projects/summary.html.erb b/views/projects/summary.html.erb index 1304f3b4..13e7c59c 100755 --- a/views/projects/summary.html.erb +++ b/views/projects/summary.html.erb @@ -1,5 +1,5 @@ -<%= erb :'partials/_projects-header', :locals => { :project => project, :countryOrRegion => countryOrRegion, :fundedProjectsCount => fundedProjectsCount, :fundingProjectsCount => fundingProjectsCount, :active => "summary"} %> +<%= erb :'partials/_projects-header', :locals => { :project => project, :countryOrRegion => countryOrRegion, :fundedProjectsCount => fundedProjectsCount, :fundingProjectsCount => fundingProjectsCount, :r4dDocsCount => r4dDocsCount, :active => "summary"} %>