From 643258a54b823abab3a775240289cb717fe0849c Mon Sep 17 00:00:00 2001 From: Songsheng Tao Date: Wed, 8 Apr 2020 13:24:28 -0400 Subject: [PATCH] Revert "MAINT: move get_person to tools.py" This reverts commit 21ff79ef --- regolith/builders/coabuilder.py | 24 +++++++++++++++++++++++- regolith/tools.py | 22 ---------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/regolith/builders/coabuilder.py b/regolith/builders/coabuilder.py index 315a6ce82..e205341cc 100644 --- a/regolith/builders/coabuilder.py +++ b/regolith/builders/coabuilder.py @@ -12,7 +12,7 @@ from regolith.dates import month_to_int from regolith.sorters import position_key from regolith.tools import all_docs_from_collection, filter_publications, \ - fuzzy_retrieval, is_since, get_person + fuzzy_retrieval, is_since NUM_MONTHS = 48 @@ -319,6 +319,28 @@ def unmerge(ws, cells): return +def get_person(person_id, rc): + """Get the person's name.""" + person_found = fuzzy_retrieval( + all_docs_from_collection(rc.client, "people"), + ["name", "aka", "_id"], + person_id, + case_sensitive=False + ) + if person_found: + return person_found + person_found = fuzzy_retrieval( + all_docs_from_collection(rc.client, "contacts"), + ["name", "aka", "_id"], + person_id, + case_sensitive=False + ) + if person_found: + return person_found + print("WARNING: {} missing from people and contacts. Check aka.".format(person_id)) + return None + + def find_coeditors(person, rc): """Get the coeditors info of the person. Return (last, first, inst, journal).""" emps = person.get('employment') diff --git a/regolith/tools.py b/regolith/tools.py index ba749655a..efcabf8d2 100644 --- a/regolith/tools.py +++ b/regolith/tools.py @@ -792,25 +792,3 @@ def is_fully_loaded(appts): datearray[list(loading).index(min(loading))] )) return status - - -def get_person(person_id, rc): - """Get the person's name.""" - person_found = fuzzy_retrieval( - all_docs_from_collection(rc.client, "people"), - ["name", "aka", "_id"], - person_id, - case_sensitive=False - ) - if person_found: - return person_found - person_found = fuzzy_retrieval( - all_docs_from_collection(rc.client, "contacts"), - ["name", "aka", "_id"], - person_id, - case_sensitive=False - ) - if person_found: - return person_found - print("WARNING: {} missing from people and contacts. Check aka.".format(person_id)) - return None