Skip to content

Commit

Permalink
Fix issue with authors
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanJField committed Sep 7, 2023
1 parent 6e94bb5 commit 15e5ccf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ authors:
affiliation: University of Glasgow
orcid: https://orcid.org/0000-0002-4424-9890

date-released: 2022-08-25
date-released: 2023-09-07
keywords:
- FAIR Data Pipeline
- FAIR
Expand All @@ -36,4 +36,4 @@ license: BSD-2-Clause
message: If you use this software, please cite it using these metadata.
repository-code: https://github.com/FAIRDataPipeline/FAIR-CLI/
title: "The FAIR Data Pipeline command line tool"
version: 0.9.3
version: 0.9.4
45 changes: 33 additions & 12 deletions fair/registry/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,21 +337,16 @@ def _get_new_url(
_tmp_obj = fdp_req.url_get(object_url, origin_token)
if "authors" in _tmp_obj:
for _author_url in _tmp_obj["authors"]:
_new_author_urls.append(sync_dependency_chain(
_author_url,
dest_uri,
_new_author_urls.append(get_new_author_url(
origin_uri,
dest_token,
origin_token,
local_data_store,
public,
remote_author_url
dest_uri,
dest_token,
_author_url
))
for _new_author_dict in _new_author_urls:
for _new_author_url in _new_author_dict.values():
if "author" in _new_author_url:
_new_obj_data["authors"].append(_new_author_url)
_filters["authors"].append(fdp_req.get_obj_id_from_url(_new_author_url))
for _new_author_url in _new_author_urls:
_new_obj_data["authors"].append(_new_author_url)
_filters["authors"].append(fdp_req.get_obj_id_from_url(_new_author_url))

if _obj_type == "author":
if "identifier" in _new_obj_data:
Expand Down Expand Up @@ -420,6 +415,32 @@ def sync_user_author(
current_user_url = current_user[0]['url']
fdp_store.store_user_author(dest_uri, dest_token, current_user_url, author_url)

def get_new_author_url(
origin_uri: str,
origin_token: str,
dest_uri: str,
dest_token: str,
author_url: str
) -> None:
_author_data = fdp_req.url_get(author_url, token=origin_token)
_writable_fields = fdp_req.get_writable_fields(
origin_uri, "author", origin_token
)
_writable_data = {
k: v
for k, v in _author_data.items()
if k in _writable_fields
}
return _get_new_url(
origin_uri,
origin_token,
dest_uri,
dest_token,
author_url,
{},
_writable_data
)

def sync_data_products(
origin_uri: str,
dest_uri: str,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
]
description = "Synchronization interface for the SCRC FAIR Data Pipeline registry"
name = "fair-cli"
version = "0.9.3"
version = "0.9.4"

homepage = "https://www.fairdatapipeline.org/"

Expand Down

0 comments on commit 15e5ccf

Please sign in to comment.