From c2899694938bc77d89630e627b7089d96d45048c Mon Sep 17 00:00:00 2001
From: anonymous <anonymous>
Date: Wed, 26 Jun 2019 17:01:53 +0200
Subject: [PATCH] tags new dataset if created within one month

---
 ckanext/odsh/plugin.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py
index 95af0599..7531b568 100644
--- a/ckanext/odsh/plugin.py
+++ b/ckanext/odsh/plugin.py
@@ -553,7 +553,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
     def before_view(self, pkg_dict):
         '''
         add a key 'is_new' to pkg_dict
-        the value for this key is True if the dataset has been modified within the last month
+        the value for this key is True if the dataset has been created within the last month
         the value is used in the snippet package_item.html
         '''
         is_new = self._is_package_new(pkg_dict)
@@ -561,8 +561,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
         return pkg_dict
     
     def _is_package_new(self, pkg_dict):
-        date_last_modified = self._get_date_from_string(pkg_dict['metadata_modified'])
-        is_new = odsh_helpers.is_within_last_month(date_last_modified)
+        date_package_created = self._get_date_from_string(pkg_dict['metadata_created'])
+        is_new = odsh_helpers.is_within_last_month(date_package_created)
         return is_new
     
     def _get_date_from_string(self, date_time_str):
-- 
GitLab