Skip to content

Commit

Permalink
Agrega lista de tuplas (title, landingPage) para 'datasets_no_federad…
Browse files Browse the repository at this point in the history
…os' en _federation_indicators
  • Loading branch information
capitantoto committed Jun 21, 2017
1 parent 798dc14 commit bb3a135
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pydatajson/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ def _federation_indicators(self, catalog,
central_catalog = readers.read_catalog(central_catalog)
federados = 0 # En ambos catálogos
no_federados = 0
datasets_no_federados = []

# Lo busco uno por uno a ver si está en la lista de catálogos
for dataset in catalog.get('dataset', []):
Expand All @@ -940,6 +941,8 @@ def _federation_indicators(self, catalog,
break
if not found:
no_federados += 1
datasets_no_federados.append((dataset.get('title'),
dataset.get('landingPage')))

if federados or no_federados: # Evita división por 0
federados_pct = 100 * float(federados) / (federados + no_federados)
Expand All @@ -949,6 +952,7 @@ def _federation_indicators(self, catalog,
result = {
'datasets_federados_cant': federados,
'datasets_no_federados_cant': no_federados,
'datasets_no_federados': datasets_no_federados,
'datasets_federados_pct': round(federados_pct, 2)
}
return result
Expand Down

0 comments on commit bb3a135

Please sign in to comment.