Skip to content

Commit

Permalink
Added data comparison codes
Browse files Browse the repository at this point in the history
  • Loading branch information
aunindadf committed Aug 18, 2021
2 parents fa45ac2 + 6953e1a commit a6bbe6f
Show file tree
Hide file tree
Showing 6 changed files with 6,083 additions and 1,429 deletions.
1,422 changes: 0 additions & 1,422 deletions data/apiTelem/api_out.tsv

This file was deleted.

1 change: 1 addition & 0 deletions data/data-comparison/live-data.json

Large diffs are not rendered by default.

6,005 changes: 6,005 additions & 0 deletions data/data-comparison/solr-data.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions views/layouts/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<!-- <script type="text/javascript" src="http://c3js.org/js/c3.min-12912fb6.js"></script> -->
<script src="/javascripts/jquery.expander.js" type="text/javascript"></script>
<script src="/javascripts/design-custom.js" type="text/javascript"></script>
<script type="text/javascript" src="/javascripts/readMoreJS.min.js"></script>
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="/stylesheets/foundation.css" media="screen" rel="stylesheet" type="text/css" />
Expand Down
67 changes: 60 additions & 7 deletions views/search/solrTemplate.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h3 class="govuk-fieldset__heading">
<%= solrConfig['Filters'].select {|filter| filter['field'] == key}.first['title'] %>
</h1>
</h3>
</legend>
<div class="govuk-checkboxes govuk-checkboxes--small <%= key%>">
<%val.each do |item|%>
Expand Down Expand Up @@ -330,6 +330,50 @@
<%end%>
</div>
</fieldset>
<!-- <div class="govuk-accordion__section ">
<div class="govuk-accordion__section-header">
<h4 class="govuk-accordion__section-heading">
<span class="govuk-accordion__section-button" id="accordion-default-heading-1">
<%= solrConfig['Filters'].select {|filter| filter['field'] == key}.first['title'] %>
</span>
</h4>
</div>
<div id="accordion-default-content-1" class="govuk-accordion__section-content" aria-labelledby="accordion-default-heading-1">
<div class="govuk-checkboxes govuk-checkboxes--small <%= key%>">
<%val.each do |item|%>
<div class="govuk-checkboxes__item">
<%if !(solrConfig['Filters'].select {|filter| filter['field'] == key}.first['defaultValue'] == item['value'])%>
<input class="govuk-checkboxes__input" name="<%= key%>" type="checkbox" value="<%= item['value']%>">
<label class="govuk-label govuk-checkboxes__label">
<%= item['key']%>
</label>
<%else%>
<%if searchType == 'F' && isIncludeClosedProjects.to_i == 1%>
<input class="govuk-checkboxes__input" name="<%= key%>" type="checkbox" value="<%= item['value']%>">
<label class="govuk-label govuk-checkboxes__label">
<%= item['key']%>
</label>
<%else%>
<input class="govuk-checkboxes__input" name="<%= key%>" checked type="checkbox" value="<%= item['value']%>">
<label class="govuk-label govuk-checkboxes__label">
<%= item['key']%>
</label>
<%end%>
<%end%>
</div>
<%end%>
<%if (solrConfig['Filters'].select {|filter| filter['field'] == key}.first['defaultValue'] == '')%>
<input class="selectedFilters" type="hidden">
<%else%>
<%if searchType == 'F' && isIncludeClosedProjects.to_i == 1%>
<input class="selectedFilters" type="hidden">
<%else%>
<input class="selectedFilters" type="hidden" value="<%= solrConfig['Filters'].select {|filter| filter['field'] == key}.first['field']%>:(<%= solrConfig['Filters'].select {|filter| filter['field'] == key}.first['defaultValue']%>)">
<%end%>
<%end%>
</div>
</div>
</div> -->
<%end%>
<%end%>
</div>
Expand All @@ -351,14 +395,14 @@
<%=item['reporting_org_narrative'].first%>
<%end%>
</p>
<p class="govuk-body">
<p class="govuk-body description">
<%begin%>
<%=item['description_narrative'].first%>
<%rescue%>
No Description Available
<%end%>
</p>
<a href="/projects/<%=ERB::Util.url_encode(item['iati_identifier']).to_s%>/summary">Learn more</a>
<!-- <a href="/projects/<%=ERB::Util.url_encode(item['iati_identifier']).to_s%>/summary">Learn more</a> -->
</div>
<div class="govuk-grid-column-one-quarter">
<h4>Project identifier:</h4> <p><%=item['iati_identifier']%></p>
Expand Down Expand Up @@ -611,14 +655,14 @@
<%=item['reporting_org_narrative'].first%>
<%end%>
</p>
<p class="govuk-body">
<p class="govuk-body description">
<%begin%>
<%=item['description_narrative'].first%>
<%rescue%>
No Description Available
<%end%>
</p>
<a href="/projects/<%=ERB::Util.url_encode(item['iati_identifier']).to_s%>/summary">Learn more</a>
<!-- <a href="/projects/<%=ERB::Util.url_encode(item['iati_identifier']).to_s%>/summary">Learn more</a> -->
</div>
<div class="govuk-grid-column-one-quarter">
<h4>Project identifier:</h4> <p><%=item['iati_identifier']%></p>
Expand All @@ -639,6 +683,15 @@
<%end%>
</div>
<script src="/javascripts/jquery.simplePagination.js" type="text/javascript"></script>
<script type="text/javascript">
$readMoreJS.init({
target: '.description',
numOfWords: 25,
toggle: true,
moreLink: 'Read more ...',
lessLink: 'Read less'
});
</script>
<script>
$(document).ready(function (){
var activityStatus = <%= activityStatus.to_json%>;
Expand Down Expand Up @@ -816,10 +869,10 @@
var reporting_org = 'UK - Foreign, Commonwealth and Development Office';
}
if(typeof result.description_narrative === 'undefined'){
prepareContainer = prepareContainer + '<div class="govuk-grid-row divider"><div class="govuk-grid-column-three-quarters"><h3><a href="/projects/'+encodeURIComponent(result.iati_identifier).toString()+'/summary">' + result.title_narrative[0] + '</a></h3><p>' + reporting_org + '</p><p class="govuk-body">' + 'No description available' + '</p><a href="/projects/'+result.iati_identifier+'">' + 'Learn more' + '</a></div><div class="govuk-grid-column-one-quarter"><h4>Project identifier:</h4> <p>' + result.iati_identifier + '</p><h4>Start Date:</h4><p> ' + result.activity_date_start_actual + '</p><h4>Activity Status:</h4><p>' + activityStatus[parseInt(result.activity_status_code) - 1].name + '</p><h4>Total Budget:</h4><p>'+result.totalBudgetWithCurrency+'</p></div></div><br />';
prepareContainer = prepareContainer + '<div class="govuk-grid-row divider"><div class="govuk-grid-column-three-quarters"><h3><a href="/projects/'+encodeURIComponent(result.iati_identifier).toString()+'/summary">' + result.title_narrative[0] + '</a></h3><p>' + reporting_org + '</p><p class="govuk-body description">' + 'No description available' + '</p></div><div class="govuk-grid-column-one-quarter"><h4>Project identifier:</h4> <p>' + result.iati_identifier + '</p><h4>Start Date:</h4><p> ' + result.activity_date_start_actual + '</p><h4>Activity Status:</h4><p>' + activityStatus[parseInt(result.activity_status_code) - 1].name + '</p><h4>Total Budget:</h4><p>'+result.totalBudgetWithCurrency+'</p></div></div><br />';
}
else{
prepareContainer = prepareContainer + '<div class="govuk-grid-row divider"><div class="govuk-grid-column-three-quarters"><h3><a href="/projects/'+encodeURIComponent(result.iati_identifier).toString()+'/summary">' + result.title_narrative[0] + '</a></h3><p>' + reporting_org + '</p><p class="govuk-body">' + result.description_narrative[0] + '</p><a href="/projects/'+result.iati_identifier+'">' + 'Learn more' + '</a></div><div class="govuk-grid-column-one-quarter"><h4>Project identifier:</h4> <p>' + result.iati_identifier + '</p><h4>Start Date:</h4><p> ' + result.activity_date_start_actual + '</p><h4>Activity Status:</h4><p>' + activityStatus[parseInt(result.activity_status_code) - 1].name + '</p><h4>Total Budget:</h4><p>'+result.totalBudgetWithCurrency+'</p></div></div><br />';
prepareContainer = prepareContainer + '<div class="govuk-grid-row divider"><div class="govuk-grid-column-three-quarters"><h3><a href="/projects/'+encodeURIComponent(result.iati_identifier).toString()+'/summary">' + result.title_narrative[0] + '</a></h3><p>' + reporting_org + '</p><p class="govuk-body description">' + result.description_narrative[0] + '</p></div><div class="govuk-grid-column-one-quarter"><h4>Project identifier:</h4> <p>' + result.iati_identifier + '</p><h4>Start Date:</h4><p> ' + result.activity_date_start_actual + '</p><h4>Activity Status:</h4><p>' + activityStatus[parseInt(result.activity_status_code) - 1].name + '</p><h4>Total Budget:</h4><p>'+result.totalBudgetWithCurrency+'</p></div></div><br />';
}
})
$('#response-container').html(prepareContainer);
Expand Down
16 changes: 16 additions & 0 deletions views/tests/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="row">
<div class="twelve columns content">
<h2 class="section-group-title">Sector Breakdown</h2>
<div class="row">
<div class="twelve columns">
<p>Budget data comparison between live OIPA and solr end point data for country</p>
</div>
<div class="twelve columns">
<table>

</table>
</div>
</div>

</div>
</div>

0 comments on commit a6bbe6f

Please sign in to comment.