Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add public and professional summary when f_prum #657

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions regolith/helpers/u_finishprumhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def subparser(subpi):
subpi.add_argument("-d", "--database",
help="The database that will be updated. Defaults to "
"first database in the regolithrc.json file.")
subpi.add_argument("--pub_sum", type = str,
dragonyanglong marked this conversation as resolved.
Show resolved Hide resolved
help="The public summary that is mandatory for finishing a prum.")
subpi.add_argument("--pro_sum", type = str,
help="The professional summary that is mandatory for finishing a prum.")
dragonyanglong marked this conversation as resolved.
Show resolved Hide resolved
return subpi


Expand Down Expand Up @@ -60,6 +64,16 @@ def db_updater(self):
print("Please rerun the helper specifying the complete ID.")
return
found_projectum.update({'status':'finished'})
if rc.pub_sum:
found_projectum['deliverable'].update({'public_summary': rc.pub_sum})
dragonyanglong marked this conversation as resolved.
Show resolved Hide resolved
elif found_projectum['deliverable'].get('public_summary') is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logic should probably be:

if not found_prum['professional_summary']:
  if rc.pro_sum:
     found_prum['professional_summary'] = rc.pro_sum
  else:
     raise RuntimeError("ERROR: please rerun with a professional summary in field --pro_sum and public summary in --pub_sum")

and

if not found_prum['public_summary']:
  if rc.pub_sum:
     found_prum['professional_summary'] = rc.pub_sum
  else:
     raise RuntimeError("ERROR: please rerun with a professional summary in field --pro_sum and public summary in --pub_sum")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Simon, I am a bit hesitate to change the logic into this way, because once we update the schema.py and a_projectumhelper.py, when people create a new prum, the professional_summary field will automatically have some words there (because we initize it).

In this situation, the first if statmentif not found_prum['public_summary']: is useless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should prevent people entering random stuff or not changing the original initialization words in the professional_summary field when people finish a prum.

print("Error: please enter the public summary by specifying pub_sum argument.")
return
if rc.pro_sum:
found_projectum['deliverable'].update({'professional_summary': rc.pro_sum})
elif found_projectum['deliverable'].get('professional_summary') is not None:
print("Error: please enter the professional summary by specifying pro_sum argument.")
return
if rc.end_date:
found_projectum.update({'end_date': date_parser.parse(rc.end_date).date()})
else:
Expand Down