Skip to content

Commit

Permalink
IndicatorsGenerator: fix a cálculo de entidades totales
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslavandeira committed Apr 9, 2018
1 parent d4458fc commit 823ab73
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def calculate_dataset_indicators(self, node, data_json):
available = len(data_json.get_datasets(only_time_series=True))
self.create(type=Indicator.DATASET_AVAILABLE, value=available, node=node)

total = Field.objects.values_list('distribution__dataset').distinct().count()
total = Field.objects.filter(distribution__dataset__catalog=catalog)\
.values_list('distribution__dataset').distinct().count()
self.create(type=Indicator.DATASET_TOTAL, value=total, node=node)

def calculate_distribution_indicators(self, node, data_json):
Expand Down Expand Up @@ -118,7 +119,8 @@ def calculate_distribution_indicators(self, node, data_json):
node=node)

self.create(type=Indicator.DISTRIBUTION_TOTAL,
value=Field.objects.values_list('distribution').distinct().count(),
value=Field.objects.filter(distribution__dataset__catalog=catalog).
values_list('distribution').distinct().count(),
node=node)

def calculate_series_indicators(self, node, data_json):
Expand Down Expand Up @@ -164,4 +166,6 @@ def calculate_series_indicators(self, node, data_json):
value=len(data_json.get_fields(only_time_series=True)),
node=node)

self.create(type=Indicator.FIELD_TOTAL, value=Field.objects.count(), node=node)
self.create(type=Indicator.FIELD_TOTAL,
value=Field.objects.filter(distribution__dataset__catalog=catalog).count(),
node=node)

0 comments on commit 823ab73

Please sign in to comment.