Skip to content

Commit

Permalink
Merge pull request ckan#39 from qld-gov-au/QOLSVC-1251_hideBadgeOnLeg…
Browse files Browse the repository at this point in the history
…acyResources

QOLSVC-1251 hide badge on legacy resources
  • Loading branch information
duttonw authored Mar 22, 2023
2 parents 5805e81 + ad320d3 commit fb58dd0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ckanext/validation/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from six.moves.urllib.parse import urlparse
from six import string_types
from ckantoolkit import url_for, _, config, asbool,\
literal, check_ckan_version
literal, check_ckan_version, h


def _get_helpers():
Expand All @@ -23,6 +23,10 @@ def _get_helpers():

def get_validation_badge(resource, in_listing=False):

afterDate = config.get('ckanext.validation.show_badges_after_last_modified_date', "")
if afterDate and h.date_str_to_datetime(afterDate) >= h.date_str_to_datetime(resource['last_modified']):
return ''

if in_listing and not asbool(
config.get('ckanext.validation.show_badges_in_listings', True)):
return ''
Expand All @@ -31,7 +35,7 @@ def get_validation_badge(resource, in_listing=False):
return ''

statuses = {
'success': _('success'),
'success': _('valid'),
'failure': _('failure'),
'invalid': _('invalid'),
'error': _('error'),
Expand Down

0 comments on commit fb58dd0

Please sign in to comment.