Skip to content
Snippets Groups Projects
Commit 9a1294d5 authored by anonymous's avatar anonymous
Browse files

uses issued as reference for label NEW

parent c2899694
No related branches found
No related tags found
No related merge requests found
......@@ -561,10 +561,22 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
return pkg_dict
def _is_package_new(self, pkg_dict):
date_package_created = self._get_date_from_string(pkg_dict['metadata_created'])
date_package_created_as_str = self._get_date_of_package_creation_from_pkg_dict(pkg_dict)
if date_package_created_as_str == None:
is_new = False
else:
date_package_created = self._get_date_from_string(date_package_created_as_str)
is_new = odsh_helpers.is_within_last_month(date_package_created)
return is_new
def _get_date_of_package_creation_from_pkg_dict(self, pkg_dict):
if 'extras' in pkg_dict:
extras = pk_dict['extras']
issued = odsh_helpers.odsh_extract_value_from_extras(extras=extras, key='issued') # is None if issued not in extras
return issued
else:
return None
def _get_date_from_string(self, date_time_str):
# todo: update this function if used in different context
date_time_format = '%Y-%m-%dT%H:%M:%S.%f' #e.g. u'2019-06-12T11:56:25.059563'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment