aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-11-30 13:42:57 -0800
committerBryan Newbold <bnewbold@archive.org>2021-11-30 13:42:59 -0800
commit4f228b1c9ece8efe0635e44cb5fdc7ecc5c66ec7 (patch)
treec47478d5d5bfe1baa07a6c889c59d650197f48f8
parent9abb032ad65356b14efdc09c599ea63234266c46 (diff)
downloadfatcat-scholar-4f228b1c9ece8efe0635e44cb5fdc7ecc5c66ec7.tar.gz
fatcat-scholar-4f228b1c9ece8efe0635e44cb5fdc7ecc5c66ec7.zip
schema: use container redirect as ident if defined
This is to handle containers which have been merged (redirected), but the release entities have not be updated to point to the new "primary" container yet.
-rw-r--r--fatcat_scholar/issue_db.py2
-rw-r--r--fatcat_scholar/schema.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/fatcat_scholar/issue_db.py b/fatcat_scholar/issue_db.py
index 8771f7f..4d6fe04 100644
--- a/fatcat_scholar/issue_db.py
+++ b/fatcat_scholar/issue_db.py
@@ -274,7 +274,7 @@ class IssueDB:
pub_type=meta.get("pub_type"),
publisher=meta.get("publisher"),
container_issnl=container and container.issnl,
- container_ident=container and container.ident,
+ container_ident=container and (container.redirect or container.ident),
wikidata_qid=container and container.wikidata_qid,
)
if isinstance(row.publisher, list):
diff --git a/fatcat_scholar/schema.py b/fatcat_scholar/schema.py
index b170f12..14e5fed 100644
--- a/fatcat_scholar/schema.py
+++ b/fatcat_scholar/schema.py
@@ -525,7 +525,7 @@ def es_biblio_from_release(release: ReleaseEntity) -> ScholarBiblio:
if release.container:
publisher = release.publisher or release.container.publisher
container_name = container_name or release.container.name
- container_ident = release.container.ident
+ container_ident = release.container.redirect or release.container.ident
container_type = release.container.container_type
container_issnl = release.container.issnl
issns = []
@@ -625,7 +625,7 @@ def es_release_from_release(release: ReleaseEntity) -> ScholarRelease:
if release.container:
container_name = release.container.name
- container_ident = release.container.ident
+ container_ident = release.container.redirect or release.container.ident
container_issnl = release.container.issnl
container_type = release.container.container_type
else: