• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OCHA-DAP / hdx-ckan / #5596

01 Aug 2024 10:22AM UTC coverage: 72.891% (-0.005%) from 72.896%
#5596

push

coveralls-python

alexandru-m-g
HDX-10036 deal with duplicate layer names

+ cooperativeGestures
+ documentation
+ small refactoring

0 of 1 new or added line in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

11640 of 15969 relevant lines covered (72.89%)

0.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.43
/ckanext-hdx_package/ckanext/hdx_package/controller_logic/dataset_view_logic.py
1
import ckan.plugins.toolkit as tk
1✔
2

3
from ckanext.hdx_package.helpers.resource_triggers.geopreview import GIS_FORMATS, get_latest_shape_info
1✔
4

5
config = tk.config
1✔
6

7

8
def process_shapes(resources, id=None):
1✔
9
    result = []
×
10

11
    for resource in resources:
×
12
        if has_shape_info(resource):
×
13
            res_pbf_template_url = config.get('hdx.gis.resource_pbf_url')
×
14
            shp_info = get_latest_shape_info(resource)
×
15

16
            res_pbf_url = res_pbf_template_url.replace('{resource_id}', shp_info['layer_id'])
×
17
            name = resource['name']
×
NEW
18
            res_format = resource['format']
×
UNCOV
19
            shp_dict = {
×
20
                'resource_name': name,
21
                'resource_format': res_format,
22
                'url': res_pbf_url,
23
                'bounding_box': shp_info['bounding_box'],
24
                'layer_fields': shp_info.get('layer_fields', []),
25
                'layer_id': shp_info['layer_id'],
26
            }
27
            if resource.get('id') == id:
×
28
                result.insert(0, shp_dict)
×
29
            else:
30
                result.append(shp_dict)
×
31
    return result
×
32

33

34
def has_shape_info(resource):
1✔
35
    if resource.get('format', '').lower() in GIS_FORMATS and resource.get('shape_info'):
1✔
36
        shp_info = get_latest_shape_info(resource)
×
37
        if shp_info.get('state', '') == 'success':
×
38
            return {'type': 'hdx_geo_preview', 'default': None}
×
39
    return None
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc