Skip to content

Commit e3e7c63

Browse files
committed
Fixed search page bug. Tweaked search term.
1 parent c14f66f commit e3e7c63

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

devtracker.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,17 @@ def getCacheData(fileName)
934934
else
935935
activityStatuses = 'AND activity_status_code:(2 OR 3 OR 4 OR 5)'
936936
end
937+
if(!query.start_with?("\""))
938+
tempQ = '"' + query + '"'
939+
isInIdentifier = RestClient.get api_simple_log(settings.oipa_api_url + "activity?q=iati_identifier:#{tempQ}&fl=iati_identifier&rows=1")
940+
isInTitle = RestClient.get api_simple_log(settings.oipa_api_url + "activity?q=title_narrative_text:#{tempQ}&fl=iati_identifier&rows=1")
941+
checkInID = Oj.load(isInIdentifier)
942+
checkInTitle = Oj.load(isInTitle)
943+
if(checkInID['response']['numFound'].to_i == 1 || checkInTitle['response']['numFound'].to_i == 1)
944+
query = tempQ
945+
else
946+
end
947+
end
937948
filters = prepareFilters(query.to_s, 'F')
938949
response = solrResponse(query, activityStatuses, 'F', 0, '', '')
939950
if(response['response']['numFound'].to_i > 0)

views/partials/_header.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<div class="app-search-form__checkbox">
4444
<div class="govuk-checkboxes govuk-checkboxes--small" data-module="govuk-checkboxes">
4545
<div class="govuk-checkboxes__item">
46-
<input class="govuk-checkboxes__input" id="includeClosed" name="includeClosed" type="checkbox" value="hmrc">
47-
<label class="govuk-label govuk-checkboxes__label" for="includeClosed">
46+
<input class="govuk-checkboxes__input" id="includeClosedProject" name="includeClosedProject" type="checkbox" value="1">
47+
<label class="govuk-label govuk-checkboxes__label" for="includeClosedProject">
4848
Include closed programmes
4949
</label>
5050
</div>

0 commit comments

Comments
 (0)