Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
c2899694
Commit
c2899694
authored
5 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
tags new dataset if created within one month
parent
c0f73f01
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ckanext/odsh/plugin.py
+3
-3
3 additions, 3 deletions
ckanext/odsh/plugin.py
with
3 additions
and
3 deletions
ckanext/odsh/plugin.py
+
3
−
3
View file @
c2899694
...
...
@@ -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
modifi
ed within the last month
the value for this key is True if the dataset has been
creat
ed 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_modifi
ed
=
self
.
_get_date_from_string
(
pkg_dict
[
'
metadata_
modifi
ed
'
])
is_new
=
odsh_helpers
.
is_within_last_month
(
date_
last_modifi
ed
)
date_
package_creat
ed
=
self
.
_get_date_from_string
(
pkg_dict
[
'
metadata_
creat
ed
'
])
is_new
=
odsh_helpers
.
is_within_last_month
(
date_
package_creat
ed
)
return
is_new
def
_get_date_from_string
(
self
,
date_time_str
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment