Skip to content

Commit

Permalink
Merge pull request #56 from FCSCOpendata/ga-comment
Browse files Browse the repository at this point in the history
comment out resource check for download
  • Loading branch information
MuhammadIsmailShahzad authored May 17, 2022
2 parents d4e63b0 + ac8bc01 commit d339f0f
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions ckanext/fcscopendata/logic/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,19 +524,22 @@ def package_show(up_func,context,data_dict):
except:
log.error(f'package {id} stats not available')

resources = result.get('resources')
overall_stat = 0
for i, resource in enumerate(resources):
resource_id = resource.get('id')
try:
stats = logic.get_action('resource_stats')(context, {'resource_id': resource_id})
result['resources'][i]['total_downloads'] = stats
overall_stat += int(stats)
except:
log.error(f'resource {resource_id} not found')
# resources = result.get('resources')
# overall_stat = 0
# for i, resource in enumerate(resources):
# resource_id = resource.get('id')
# try:
# stats = logic.get_action('resource_stats')(context, {'resource_id': resource_id})
# result['resources'][i]['total_downloads'] = stats
# overall_stat += int(stats)
# except:
# log.error(f'resource {resource_id} not found')

# if "total_downloads" not in result:
# result['total_downloads'] = overall_stat

if "total_downloads" not in result:
result['total_downloads'] = overall_stat
result['total_downloads'] = 0
return result


Expand Down

0 comments on commit d339f0f

Please sign in to comment.