Skip to content

Commit b8b8a9d

Browse files
authored
Merge pull request #624 from DFID/add-data-parsed-checker
Add data parsed checker
2 parents 53ba99c + 8dc2091 commit b8b8a9d

3 files changed

Lines changed: 76 additions & 1 deletion

File tree

devtracker.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,30 @@ def getCacheData(fileName)
14031403
}
14041404
end
14051405

1406+
get '/check-index-status' do
1407+
apiRouteForDataSetsH1 = 'https://fcdo.iati.cloud/search/activity/?q=iati_identifier:(GB-1-*%20OR%20GB-GOV-1-*)%20AND%20hierarchy:1&rows=0&fl=iati_identifier&facet=on&facet.field=dataset_name'
1408+
settings.devtracker_page_title = 'Test data'
1409+
liveData = Oj.load(RestClient.get apiRouteForDataSetsH1)
1410+
data = liveData['facet_counts']['facet_fields']['dataset_name']
1411+
dataSetHash = []
1412+
for i in 1..20 do
1413+
tempData = {}
1414+
tempData['setName'] = 'FCDO-SET-'+i.to_s
1415+
if data.include?('fcdo-set-'+i.to_s)
1416+
tempData['isParsed'] = 'Yes'
1417+
else
1418+
tempData['isParsed'] = 'No'
1419+
end
1420+
dataSetHash.push(tempData)
1421+
end
1422+
erb :'indexing-status/index',
1423+
:layout => :'layouts/landing',
1424+
:locals => {
1425+
oipa_api_url: settings.oipa_api_url,
1426+
dataSetHash: dataSetHash
1427+
}
1428+
end
1429+
14061430
#####################################################################
14071431
# STATIC PAGES
14081432
#####################################################################

helpers/project_helpers.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,8 @@ def get_transaction_details_pagev2(projectId, transactionType, page, count)
522522
if t['transaction-type']['code'].to_i == transactionType.to_i
523523
tempTransaction = {}
524524
receiverOrgType = ''
525-
currency = activity.has_key?('default-currency') ? activity['default-currency'] : 'GBP'
525+
#currency = activity.has_key?('default-currency') ? activity['default-currency'] : 'GBP'
526+
currency = t.has_key?('value.currency') ? t['value.currency'] : 'GBP'
526527
if t.has_key?('receiver-org')
527528
receiverOrgRef = t['receiver-org']['ref']
528529
if !activity['participating_org_ref'].find_index(receiverOrgRef.to_s).nil?
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<div class="row">
2+
<div class="twelve columns content">
3+
<h2 class="section-group-title">Indexed Data Set List</h2>
4+
<div class="row">
5+
<div class="twelve columns">
6+
<p>FCDO XML file list with their indexing status</p>
7+
</div>
8+
<div class="twelve columns">
9+
<table id="dataTable" class="display" style="width: 100%">
10+
<thead>
11+
<tr>
12+
<th>Data Set</th>
13+
<th>Is Indexed?</th>
14+
</tr>
15+
</thead>
16+
<tbody>
17+
<%dataSetHash.each do |val|%>
18+
<tr>
19+
<td><%= val['setName'] %></td>
20+
<td <%if val['isParsed'] == 'No' %>style="color: red; font-weight: bold"<%else%>style="color: green"<%end%>><%= val['isParsed'] %></td>
21+
</tr>
22+
<%end%>
23+
</tbody>
24+
</table>
25+
</div>
26+
</div>
27+
</div>
28+
</div>
29+
<script src="https://code.jquery.com/jquery-3.5.1.js" type="text/javascript"></script>
30+
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js" type="text/javascript"></script>
31+
<script src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js" type="text/javascript"></script>
32+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js" type="text/javascript"></script>
33+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" type="text/javascript"></script>
34+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js" type="text/javascript"></script>
35+
<script src="https://cdn.datatables.net/buttons/1.7.1/js/buttons.html5.min.js" type="text/javascript"></script>
36+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
37+
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.1/css/buttons.dataTables.min.css">
38+
<script>
39+
40+
$('#dataTable').DataTable({
41+
"info": false,
42+
"paging": false,
43+
"searching": false,
44+
"ordering": [],
45+
"dom": "Bfrtip",
46+
"buttons": [
47+
'csv', 'excel', 'pdf'
48+
]
49+
});
50+
</script>

0 commit comments

Comments
 (0)