Skip to content

Commit

Permalink
Revert "MAINT: move get_person to tools.py"
Browse files Browse the repository at this point in the history
This reverts commit 21ff79e
  • Loading branch information
st3107 committed Apr 8, 2020
1 parent 21ff79e commit 643258a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
24 changes: 23 additions & 1 deletion regolith/builders/coabuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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')
Expand Down
22 changes: 0 additions & 22 deletions regolith/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 643258a

Please sign in to comment.