Skip to content

Commit

Permalink
Merge pull request #1047 from sbillinge/fix_cp_tests
Browse files Browse the repository at this point in the history
Fix cp tests
  • Loading branch information
sbillinge authored Nov 3, 2023
2 parents 825e4ec + b7b7467 commit 05a000b
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 14 deletions.
12 changes: 6 additions & 6 deletions regolith/builders/cpbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ def latex(self):
gtx = self.gtx
rc = self.rc
for group in self.gtx["groups"]:
gtx["grants"] = list(sorted(
self.gtx["grants"] = list(sorted(
all_docs_from_collection(rc.client, "grants"), key=_id_key
))
gtx["proposals"] = list(sorted(
self.gtx["proposals"] = list(sorted(
all_docs_from_collection(rc.client, "proposals"), key=_id_key
))
grp = group["_id"]
pi = fuzzy_retrieval(
self.gtx["people"], ["aka", "name"], group["pi_name"]
self.gtx["people"], ["_id", "aka", "name"], group["pi_name"]
)
pinames = pi["name"].split()
piinitialslist = [i[0] for i in pinames]
Expand All @@ -74,7 +74,7 @@ def latex(self):
dt.date(1900, 1, 2))
for person in g.get("team", []):
rperson = fuzzy_retrieval(
self.gtx["people"], ["aka", "name"], person["name"]
self.gtx["people"], ["_id", "aka", "name"], person["name"]
)
if rperson:
person["name"] = rperson["name"]
Expand All @@ -98,8 +98,8 @@ def latex(self):
g['subaward_amount'] = sum(amounts)

pending_grants = [
g for g in self.gtx["proposals"]
if is_pending(g["status"])
g for g in grants
if is_pending(g.get("status", ""))
]
for g in pending_grants:
for person in g["team"]:
Expand Down
14 changes: 11 additions & 3 deletions regolith/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
"_id": "SymPy-1.1",
"amount": 3000.0,
"alias": "sym",
"awardnr": "NF-1234",
"begin_day": 1,
"begin_month": "May",
"begin_year": 2030,
Expand Down Expand Up @@ -409,6 +410,7 @@
"_id": "SymPy-2.0",
"amount": 3000.0,
"alias": "sym2.0",
"awardnr": "NF-1234",
"begin_day": 1,
"begin_month": 6,
"begin_year": 2019,
Expand Down Expand Up @@ -1947,8 +1949,14 @@
"project_scope": ""
},
"currency": "USD",
"pi": "sbillinge",
"status": "submitted",
"pi": "Anthony Scopatz",
"status": "pending",
"team": [
{
"institution": "Columbia University",
"name": "scopatz",
"position": "pi",
}],
"title": "SymPy 1.1 Release Support",
},
{
Expand All @@ -1966,7 +1974,7 @@
},
"currency": "USD",
"pi": "sbillinge",
"status": "submitted",
"status": "accepted",
"title": "SymPy 1.1 Release Support",
},
{
Expand Down
10 changes: 7 additions & 3 deletions tests/outputs/a_proposal/proposals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ SymPy-1.1:
project_scope: ''
currency: USD
end_date: '2030-12-31'
pi: sbillinge
status: submitted
pi: Anthony Scopatz
status: pending
team:
- institution: Columbia University
name: scopatz
position: pi
title: SymPy 1.1 Release Support
SymPy-2.0:
amount: 3000.0
Expand All @@ -52,7 +56,7 @@ SymPy-2.0:
currency: USD
end_date: '2030-12-31'
pi: sbillinge
status: submitted
status: accepted
title: SymPy 1.1 Release Support
abc42:
amount: 42000.0
Expand Down
119 changes: 119 additions & 0 deletions tests/outputs/current-pending/current-pending-ergs-scopatz.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
\documentclass[prl,tighten,amsmath,amssymb,floatfix]{revtex4-1}


% Packages
\usepackage{graphicx}
\usepackage{times}
\usepackage{booktabs,dcolumn}
\usepackage{siunitx}
\usepackage[utf8]{inputenc}

\setlength{\parindent}{0pt}

% Document
\begin{document}
\textbf{Current and Pending Support}

\textbf{ANTHONY SCOPATZ}
\vskip 14pt


\textit{Pending}

\vskip 12pt\noindent
\textbf{Investigator:} Anthony Scopatz\
\textbf{Other Agencies to which proposal submitted:}
None

\textbf{Support:}\ Pending

\textbf{Project/Proposal Title:} SymPy 1.1 Release Support
\ (multi-PI grant. AS
amt = \$0.0)

\textbf{Source of Support:}\
NumFOCUS

\textbf{Total Award Amount}:
\$3,000.0\\
\textbf{ Total Award Period Covered:}
5/1/2030 - 12/31/2030

\textbf{Location of Project:} Columbia University

\textbf{Person Months per Year Committed to Project:}
\textbf{Academic:} 0\
\textbf{Summer:} 1

\textbf{Describe Research Including Synergies and Delineation with
Respect to this Proposal/Award:}

\vskip 12pt\noindent
\textbf{Investigator:} Anthony Scopatz\
\textbf{Other Agencies to which proposal submitted:}
None

\textbf{Support:}\ Pending

\textbf{Project/Proposal Title:} SymPy 1.1 Release Support
\ (multi-PI grant. AS
amt = \$0.0)

\textbf{Source of Support:}\
NumFOCUS

\textbf{Total Award Amount}:
\$3,000.0\\

\textbf{ Total Award Period Covered:}
6/1/2019 - 12/31/2030

\textbf{Location of Project:} Columbia University

\textbf{Person Months per Year Committed to Project:}
\textbf{Academic:} 0\
\textbf{Summer:} 1

\textbf{Describe Research Including Synergies and Delineation with
Respect to this Proposal/Award:}

\vskip 14pt


\textit{Current}

\vskip 12pt\noindent
\textbf{Investigator:} Anthony Scopatz\
\textbf{Other Agencies to which proposal submitted:}
None

\textbf{Support:}\ Current

\textbf{Project/Proposal Title:} SymPy 1.1 Release Support
\ (multi-PI grant. AS
amt = \$3,000.0)


\textbf{Source of Support:}\
NumFOCUS
(NF-1234)

\textbf{Total Award Amount}:
\$3,000.0\\
\textbf{ Total Award Period Covered:}
6/1/2019 - 12/31/2030

\textbf{Location of Project:} Columbia University

\textbf{Person Months per Year Committed to Project:}
\textbf{Academic:} 0\
\textbf{Summer:} 1

\textbf{Describe Research Including Synergies and Delineation with
Respect to this Proposal/Award:}

\vskip 14pt



\end{document}
2 changes: 1 addition & 1 deletion tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"review-prop",
"annual-activity",
"beamplan",
# "current-pending",
"current-pending",
"figure",
"formalletter",
# "html",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
),
(["helper", "l_grants", "--current", "--date", "2020-05-25"],
"Administered by: missing\n"
" sym2.0 \t awardnr: \t acctn: n/a \t 2019-06-01 to 2030-12-31\n"
" sym2.0 \t awardnr: NF-1234 \t acctn: n/a \t 2019-06-01 to 2030-12-31\n"
),
(["helper", "l_members", "--current", "-v"],
" -- Assistant Scientists --\n"
Expand Down

0 comments on commit 05a000b

Please sign in to comment.