Repository: regro/regolith

Issue:
ENH: projecta lister better handling of whether pra are open or closed
current behavior:
Not sure, so documentation that is displayed by argparse help needs to be a bit richer, but I think by default it only lists pra that are open (not finished, cancelled or back_burner for example)

desired behavior:
other than a fix to the documentation to make this explicit, if the behavior is to list only open (not closed) pra by default, then a command line arg that allows this to be turned off (so ``--all`` prints all pra).  If, by default, it is printing all pra, then change default to just returning open pra.
MNT: remove -s from l_projecta
the functionality is not working, but also it is now handled by ``-f status finished`` that is working

Discussion:

Patch:
diff --git a/regolith/helpers/l_projectahelper.py b/regolith/helpers/l_projectahelper.py
index fa9ace1d..9425c043 100644
--- a/regolith/helpers/l_projectahelper.py
+++ b/regolith/helpers/l_projectahelper.py
@@ -21,10 +21,12 @@ from regolith.tools import (
 
 TARGET_COLL = "projecta"
 HELPER_TARGET = "l_projecta"
-ALLOWED_STATI = ["proposed", "started", "finished", "back_burner", "paused", "cancelled"]
 
 
 def subparser(subpi):
+    subpi.add_argument("--all", action="store_true",
+                       help="Lists all projecta that have not ended"
+                       )
     subpi.add_argument("-v", "--verbose", action="store_true", help='increase verbosity of output')
     subpi.add_argument("-l", "--lead",
                        help="Filter milestones for this project lead"
@@ -32,10 +34,6 @@ def subparser(subpi):
     subpi.add_argument("-p", "--person",
                        help="Filter milestones for this person whether lead or not"
                        )
-    subpi.add_argument("-s", "--stati", nargs="+",
-                       help=f"List of stati for the project that you want returned,"
-                            f"from {ALLOWED_STATI}.  Default is proposed and started"
-                       )
     subpi.add_argument("-e", "--ended", action="store_true",
                        help="Lists projects that have ended. Use the -d and -r flags to specify"
                             "from one date and how many days"
@@ -104,7 +102,7 @@ class ProjectaListerHelper(SoutHelperBase):
         else:
             collection = self.gtx["projecta"]
 
-        if (not rc.lead) and (not rc.person) and (not rc.ended) and (not rc.grant) and (not rc.verbose) and (not rc.grp_by_lead) and (not rc.filter):
+        if (not rc.lead) and (not rc.person) and (not rc.ended) and (not rc.grant) and (not rc.verbose) and (not rc.grp_by_lead) and (not rc.filter) and (not rc.all):
             return
         if rc.date:
             desired_date = date_parser.parse(rc.date).date()
@@ -116,13 +114,15 @@ class ProjectaListerHelper(SoutHelperBase):
         else:
             num_of_days = 7
 
-        bad_stati = ["finished", "cancelled", "paused", "back_burner"]
         projecta = []
         end_projecta = []
         grouped_projecta = {}
         if rc.lead and rc.person:
             raise RuntimeError(f"please specify either lead or person, not both")
         for projectum in collection:
+            if rc.all and projectum.get('status') != "finished":
+                projecta.append(projectum)
+                continue
             if isinstance(projectum.get('group_members'), str):
                 projectum['group_members'] = [projectum.get('group_members')]
             if rc.lead and projectum.get('lead') != rc.lead:
@@ -140,10 +140,6 @@ class ProjectaListerHelper(SoutHelperBase):
                     continue
             if rc.grant and rc.grant not in projectum.get('grants'):
                 continue
-            if not rc.ended and not rc.stati and projectum.get('status') in bad_stati:
-                continue
-            if rc.stati and projectum.get('status') not in rc.stati:
-                continue
             if rc.ended and not projectum.get('end_date'):
                 continue
             if rc.ended:


Test patch:
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 84df9ac0..70bf2881 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -46,6 +46,9 @@ helper_map = [
     (["helper", "l_projecta", "--grp_by_lead"],
      "lyang:\n    20ly_newprojectum\nascopatz:\n    20sb_firstprojectum\n"
      ),
+    (["helper", "l_projecta", "--all"],
+     "20ly_newprojectum\n20sb_firstprojectum\n"
+     ),
     (["helper", "l_projecta", "--grp_by_lead", "-l", "ascopatz"],
      "ascopatz:\n    20sb_firstprojectum\n"
      ),