Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Zharktas committed Feb 12, 2024
1 parent 6c9835b commit 9a2365f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ckanext/matomo/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def fetch(dryrun, since, until, dataset):


# Resource downloads use package id in its url
resource_download_statistics: Dict[str, Any] = api.resource_download_statistics(**params, dataset=pkg['id'] if pkg else None)
resource_download_statistics: Dict[str, Any] = api.resource_download_statistics(**params,
dataset=pkg['id'] if pkg else None)
package_show_events: Dict[str, Any] = api.events(**params, filter_pattern='package_show')

updated_package_ids_by_date = {}
Expand Down Expand Up @@ -122,7 +123,8 @@ def fetch(dryrun, since, until, dataset):
try:
downloads = sum(int(stats.get('nb_hits', 0)) for stats in resource_stats)
if dryrun:
log.info('Would update downloads stats for resource: package_id={}, resource_id={}, date={}, downloads={}'
log.info('Would update downloads stats for resource: package_id={}, '
'resource_id={}, date={}, downloads={}'
.format(package_id, resource_id, date, downloads))
else:
ResourceStats.update_downloads(resource_id, date, downloads)
Expand All @@ -133,7 +135,8 @@ def fetch(dryrun, since, until, dataset):
if package_id not in updated_package_ids:

try:
downloads = sum(int(stats.get('nb_hits', 0)) for stats_lists in stats_list.values() for stats in stats_lists)
downloads = sum(int(stats.get('nb_hits', 0)) for stats_lists in stats_list.values()
for stats in stats_lists)

if dryrun:
log.info('Would update download stats: package_id={}, date={}, downloads={}'
Expand Down

0 comments on commit 9a2365f

Please sign in to comment.