コード例 #1
0
    def get_star_html(self, resource_id):
        from ckanext.qa import reports

        report = reports.resource_five_stars(resource_id)

        stars = report.get('openness_score', -1)
        if stars >= 0:
            reason = report.get('openness_score_reason')
            return html.get_star_html(stars, reason)
        return None
コード例 #2
0
ファイル: plugin.py プロジェクト: zydio/ckanext-qa
    def get_star_html(self, resource_id):
        from ckanext.qa import reports

        report = reports.resource_five_stars(resource_id)

        stars = report.get('openness_score', -1)
        if stars >= 0:
            reason = report.get('openness_score_reason')
            return html.get_star_html(stars, reason)
        return None
コード例 #3
0
def get_resource_openness(resource_id):
    stars = 0
    reason = plugins.toolkit._('Not Rated')
    updated = ""

    if resource_id:
        resource_report = reports.resource_five_stars(resource_id)
        stars = resource_report.get('openness_score', -1)
        updated = resource_report.get('openness_updated')

        if stars >= 0:
            reason = resource_report.get('openness_score_reason')

    extra_vars = {'stars': stars, 'reason': reason, 'updated': updated}
    return extra_vars
コード例 #4
0
def get_dataset_openness(dataset_id):
    # Obtener el mayor report de todos los resource del dataset
    #report = reports.five_stars(dataset_id)
    dataset_report = five_stars(dataset_id)
    id_max_resource = ''
    max_star = 0
    stars = 0
    reason = plugins.toolkit._('Not Rated')
    updated = ""
    for resource in dataset_report:
        if resource.get('openness_score', -1) > max_star:
            max_star = resource.get('openness_score', -1)
            id_max_resource = resource.get('resource_id','')

    if id_max_resource:
        resource_report = reports.resource_five_stars(id_max_resource)
        stars = resource_report.get('openness_score', -1)
        updated = resource_report.get('openness_updated')

        if stars >= 0:
            reason = resource_report.get('openness_score_reason')

    extra_vars = {'stars': stars, 'reason': reason, 'updated': updated}
    return extra_vars
コード例 #5
0
ファイル: qa_api.py プロジェクト: opendata-ee/ckanext-qa
 def resource_five_stars(self, id):
     return json.dumps(resource_five_stars(id))
コード例 #6
0
ファイル: controller.py プロジェクト: euopendataportal/source
 def resource_five_stars(self, id):
     result = resource_five_stars(id)
     return self._output_json(result)
コード例 #7
0
ファイル: controller.py プロジェクト: Hoedic/ckanext-qa
 def resource_five_stars(self, id):
     result = resource_five_stars(id)
     return self._output_json(result)
コード例 #8
0
ファイル: qa_api.py プロジェクト: zydio/ckanext-qa
 def resource_five_stars(self, id):
     return json.dumps(resource_five_stars(id))