This PR contains updated projects command-line tool (coldfront.core.project.management.commands.projects) to enable renewal of ICA projects that have the "Inactive" status.
Added a subcommand renew by which this can be done.
It takes arguments: the name of the Project, the username of the User making the request, and the name of the AllocationPeriod the allowance will be valid for.
It will approve and process the request. I will provide you with some example code I've run manually in the past that should be adapted into this command.
Disallow renewals of other project types at this point (so only ICAs).
There should be a dry_run flag (see the create subcommand).
Assumptions made:
I assumed that the pre-project and post-project referred to the same project (namely, the inputed project).
The requester must be a part of the project or else a CommandError will be raised.
The allocation period must be currently occurring or else a CommandError will be raised.
I've done some refactoring to generalize this for renewing yearly allowances, and avoid duplicating logic.
I've also added some additional constraints to the command (e.g., the requester must be a manager or PI).
I've left some comments in test_commands.test_projects.TestProjectsRenew describing some additional test cases that should be added. Can you fill those in?
Lastly, I noted in the command that we need to prevent a request from being made if the PI isn't "allowed" to have one: this is based on whether they already have a renewal request or new project request, etc. I've been working on refactoring the logic needed for this check into a class, and will fill this in.
Based off code from @matthew-li
projects
command-line tool (coldfront.core.project.management.commands.projects
) to enable renewal of ICA projects that have the "Inactive" status.renew
by which this can be done.Project
, the username of theUser
making the request, and the name of theAllocationPeriod
the allowance will be valid for.dry_run
flag (see thecreate
subcommand).Assumptions made: