From ba34b1a24639599b107bdb9387483ad4dde2c237 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 29 Jan 2021 00:28:03 -0800 Subject: bugfix: lang_code sometimes a list --- fatcat_scholar/transform.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'fatcat_scholar/transform.py') diff --git a/fatcat_scholar/transform.py b/fatcat_scholar/transform.py index e50c411..4114885 100644 --- a/fatcat_scholar/transform.py +++ b/fatcat_scholar/transform.py @@ -138,6 +138,12 @@ def es_biblio_from_sim(sim: Dict[str, Any]) -> ScholarBiblio: if release_year and abs(release_year) > 2050: release_year = None + lang_code = SIM_LANG_MAP.get(issue_meta.get("language")) or SIM_LANG_MAP.get( + pub_meta.get("language") + ) + if isinstance(lang_code, list): + lang_code = lang_code[0] + return ScholarBiblio( # release_ident=release.ident, title=None, @@ -149,8 +155,7 @@ def es_biblio_from_sim(sim: Dict[str, Any]) -> ScholarBiblio: or SIM_RELEASE_TYPE_MAP.get(pub_meta.get("pub_type")), release_stage="published", # as a default # withdrawn_status=release.withdrawn_status, - lang_code=SIM_LANG_MAP.get(issue_meta.get("language")) - or SIM_LANG_MAP.get(pub_meta.get("language")), + lang_code=lang_code, country_code=SIM_COUNTRY_MAP.get(pub_meta.get("country")), volume=volume, volume_int=volume_int, -- cgit v1.2.3