Skip to content

Commit de1a64e

Browse files
committed
Merge branch 'devtracker-new-ui-fixed-merge-conflict' into devtracker-new-ui
2 parents eb8c8c3 + 5d75a21 commit de1a64e

13 files changed

Lines changed: 40 additions & 18 deletions

File tree

devtracker.rb

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565

6666
# Server Machine: set global settings to use varnish cache
6767
#set :oipa_api_url, 'http://127.0.0.1:6081/search/'
68-
68+
set :prod_api_url, 'https://fcdo.iati.cloud'
69+
set :dev_api_url, 'https://fcdo-staging.iati.cloud'
6970

7071

7172
#ensures that we can use the extension html.erb rather than just .erb
@@ -149,7 +150,7 @@
149150
oipa_api_url: settings.oipa_api_url,
150151
whatWeDoTotal: whatWeDoTotal,
151152
top5CountryTotal: top5CountryTotal,
152-
activiteProjectCount: activiteProjectCount,
153+
activiteProjectCount: activiteProjectCount
153154
}
154155
end
155156

@@ -231,6 +232,13 @@ def getCacheData(fileName)
231232
# Get a list of map markers
232233
mapMarkers = getCountryMapMarkers(n)
233234
settings.devtracker_page_title = 'Country ' + country['name'] + ' Summary Page'
235+
json_link = ''
236+
if request.url.start_with?('https://devtracker.')
237+
json_link = json_link + settings.prod_api_url
238+
else
239+
json_link = json_link + settings.dev_api_url
240+
end
241+
json_link = json_link + '/search/activity/?q=recipient_country_code:'+n+' AND reporting_org_ref:GB-GOV-* AND hierarchy:1&format='
234242
erb :'countries/country',
235243
:layout => :'layouts/layout',
236244
:locals => {
@@ -242,7 +250,8 @@ def getCacheData(fileName)
242250
countryGeoJsonData: geoJsonData,
243251
mapMarkers: mapMarkers,
244252
active_link: 'aidByLoc',
245-
active_sub_link: 'countrySummary'
253+
active_sub_link: 'countrySummary',
254+
json_url_link: json_link
246255
}
247256
end
248257
## country summary page related api calls
@@ -422,6 +431,14 @@ def getCacheData(fileName)
422431
end
423432
end
424433
end
434+
if(!project['reporting_org_ref'].to_s == 'GB-GOV-1')
435+
if(project.has_key?('activity_aggregation_incoming_funds_value_gbp'))
436+
programmeBudget = programmeBudget + project['activity_aggregation_incoming_funds_value_gbp'].to_f
437+
end
438+
if(project.has_key?('activity_aggregation_commitment_value_gbp'))
439+
programmeBudget = programmeBudget + project['activity_aggregation_commitment_value_gbp'].to_f
440+
end
441+
end
425442
#get project sectorwise graph data
426443
projectSectorGraphData = get_project_sector_graph_datav2(n)
427444
settings.devtracker_page_title = 'Programme '+project['iati_identifier']
@@ -834,7 +851,7 @@ def getCacheData(fileName)
834851
# SOLR BASED PAGES
835852
#####################################################################
836853

837-
get '/search/?' do
854+
get '/search_p/?' do
838855
if (!params['query'])
839856
query= ''
840857
filters = []
@@ -878,7 +895,7 @@ def getCacheData(fileName)
878895
}
879896
end
880897

881-
post '/search/?' do
898+
post '/search_p/?' do
882899
#query = params['query']
883900
query = sanitize_input(params['query'],"newId")
884901
isIncludeClosedProjects = sanitize_input(params['includeClosedProject'],"newId")

helpers/oipa_helpers.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ def non_dfid_data(projectCode)
99

1010
def activityUrlOipa(projectCode,format)
1111
#settings.oipa_api_url + "activities/" + projectCode + "?format=" + format
12-
"/api/activities/" + projectCode + "/?fields=all&format=" + format
12+
u = ''
13+
if request.url.start_with?('https://devtracker.')
14+
u = u + settings.prod_api_url
15+
else
16+
u = u + settings.dev_api_url
17+
end
18+
u+"/search/activity/?q=iati_identifier:" + projectCode + "&fl=*&format=" + format
1319
end
1420

1521
end

helpers/project_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ def project_budget_per_fyv2(projectId)
13721372

13731373
currentFinancialYear = financial_year
13741374

1375-
range = if series.size < 7 then
1375+
range = if series.size < 900 then
13761376
series
13771377
# if the last item in the list is less than or equal to
13781378
# the current financial year get the last 6

views/countries/country.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@
126126
<div class="govuk-grid-column-full">
127127
<p class="govuk-!-font-size-16 govuk-!-font-weight-bold govuk-!-margin-top-0 govuk-!-margin-bottom-0">Download IATI Activity Data for <%= country['name']%></p>
128128
<div class="app-download-data">
129-
<a href="https://iati.fcdo.gov.uk/iati_files/Country/FCDO-<%= country['name'].gsub(/ /,'-').gsub(/[()]/,"").gsub(/,/,"")%>-<%= country['code']%>.xml" class="govuk-link" target="_blank"><strong class="govuk-tag govuk-tag--blue">XML</strong></a>
130-
<a href="https://devtracker.fcdo.gov.uk/api/activities/?format=json&recipient_country=<%= country['code']%>&reporting_organisation_identifier=<%= settings.goverment_department_ids%>&page_size=<%= activityCount %>" class="govuk-link" target="_blank"><strong class="govuk-tag govuk-tag--blue">JSON</strong></a>
129+
<a href="<%= json_url_link%>json" class="govuk-link" target="_blank"><strong class="govuk-tag govuk-tag--blue">JSON</strong></a>
131130
</div>
132131
</div>
133132
</div>

views/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ layout: cw_landing
7676
<div id="event-name-hint" class="govuk-hint">
7777
Enter location, sector, organisation or keyword
7878
</div>
79-
<form id="searchForm" action="/search" class="app-search-form" method="POST" onsubmit="return validateSearch()">
79+
<form id="searchForm" action="/search_p" class="app-search-form" method="POST" onsubmit="return validateSearch()">
8080
<p id="searchQueryError" class="govuk-error-message app-display-none">
8181
<span class="govuk-visually-hidden">Error:</span> Please enter a search query
8282
</p>

views/index2.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ layout: landing
1616
<div class="row">
1717
<div class="twelve columns">
1818
<div id="search-bar">
19-
<form action="/search" method="GET">
19+
<form action="/search_p" method="GET">
2020
<div class="row">
2121
<div class="three columns">
2222
<label for="query">

views/layouts/layout_forms.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<div class="row">
154154
<div class="twelve columns">
155155
<h2><a href="/" title="Go to the homepage">Development Tracker</a></h2>
156-
<form id="search" class="site-search" action="/search" method="GET" role="search">
156+
<form id="search" class="site-search" action="/search_p" method="GET" role="search">
157157
<label for="site-search-text" class="visually-hidden">Search</label>
158158
<input type="search" name="query" id="site-search-text" title="Search"><input class="button" type="submit" value="Search">
159159
<input id="includeClosed" name="includeClosed" type="hidden" value="0">

views/new_layout/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div id="event-name-hint" class="govuk-hint">
1414
Enter location, sector, organisation or keyword
1515
</div>
16-
<form action="/search" class="app-search-form" method="post" enctype="multipart/form-data">
16+
<form action="/search_p" class="app-search-form" method="post" enctype="multipart/form-data">
1717
<div class="app-search-form__textbox">
1818
<input class="govuk-input" id="query" name="query" type="text">
1919
<button class="app-search-form__button" data-module="govuk-button"></button>

views/new_layout/layouts/landing.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</div>
3838
</header>
3939

40-
<form action="/search" method="post" enctype="multipart/form-data">
40+
<form action="/search_p" method="post" enctype="multipart/form-data">
4141
<div id="globalSearch" class="app-header__search app-element-hidden">
4242
<div class="govuk-width-container">
4343
<div class="govuk-form-group">

views/new_layout/layouts/layout.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</div>
3939
</header>
4040

41-
<form action="/search" method="post" enctype="multipart/form-data">
41+
<form action="/search_p" method="post" enctype="multipart/form-data">
4242
<div id="globalSearch" class="app-header__search app-element-hidden">
4343
<div class="govuk-width-container">
4444
<div class="govuk-form-group">

0 commit comments

Comments
 (0)