Skip to content

Commit

Permalink
Merge pull request #420 from NFDI4BIOIMAGE/git-bob-mod-4H9mFy8kyX
Browse files Browse the repository at this point in the history
Add "added_date" to entries and sort "Recently added" page by it.
  • Loading branch information
haesleinhuepf authored Nov 13, 2024
2 parents 94d116a + 502c2fe commit 97de891
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions scripts/auto-add-github-resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from _github_utilities import create_branch, get_file_in_repository, get_issue_body, write_file, send_pull_request
import yaml
from github import Github, GithubException
from datetime import datetime

def main():
"""
Expand Down Expand Up @@ -120,6 +121,8 @@ def complete_github_data(github_repo_url):
# Publication date (first release date or creation date)
entry['publication_date'] = get_publication_date(repo)

entry['added_date'] = datetime.now().isoformat()

# Tags: always add the message "Dear users, please add tags."
entry['tags'] = "TODO"

Expand Down
4 changes: 3 additions & 1 deletion scripts/auto-add-zenodo-entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
from _github_utilities import create_branch, get_file_in_repository, get_issue_body, write_file, send_pull_request
import yaml

from datetime import datetime

def main():
"""
Expand Down Expand Up @@ -99,6 +99,8 @@ def complete_zenodo_data(zenodo_url):

if 'stats' in zenodo_data.keys():
entry['num_downloads'] = zenodo_data['stats']['downloads']

entry['added_date'] = datetime.now().isoformat()

return entry

Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_link_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ def main():
author_toc += " - file: " + filename + "\n"
replace_in_file(toc_file, "{author_toc}", author_toc)

# Generate the 'What's New' page with content sorted by publication date
# Generate the 'What's New' page with content sorted by added date
sorted_content = sorted(
content['resources'],
key=lambda x: str(x.get('publication_date', '0000-00-00')),
key=lambda x: str(x.get('added_date', '0000-00-00')),
reverse=True
)[:10]

Expand Down

0 comments on commit 97de891

Please sign in to comment.