Skip to content

Commit

Permalink
cleaner output for todo lister. passing helper tests locally
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Jul 19, 2023
1 parent 65f159b commit 86e2225
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 31 deletions.
23 changes: 23 additions & 0 deletions news/todos_print-due_date.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Reformatted printing of todos to make the order clearer

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
8 changes: 4 additions & 4 deletions regolith/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ def print_task(task_list, stati, index=True):
for task in task_list:
if index:
try:
task["preamble"] = f"({task.get('running_index', 0)}) "
task["preamble"] = f"({task.get('importance')})({task.get('days_to_due')} days): ({task.get('running_index', 0)}) "
except:
task["preamble"] = ""
else:
Expand All @@ -1931,9 +1931,9 @@ def print_task(task_list, stati, index=True):
if task.get('notes'):
for note in task.get('notes'):
print(f" - {note}")
print("-" * 30)
print("Tasks (decreasing priority going up)")
print("-" * 30)
print("-" * 76)
print("(importance)(days to due): (Task number) Task (decreasing priority going up)")
print("-" * 76)
deadline_list = [task for task in task_list
if task.get('deadline') and task.get("status") in stati]
deadline_list.sort(key=lambda x: x.get("due_date"), reverse=True)
Expand Down
54 changes: 27 additions & 27 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@
"(index) action (days to due date|importance|expected duration (mins)|tags|assigned by)\n"
"--------------------------------------------------------------------------------\n"
"started:\n"
"(2) prepare the presentation (89|0|30.0|downtime|sbillinge|2saefa)\n"
"(0)(89 days): (2) prepare the presentation (89|0|30.0|downtime|sbillinge|2saefa)\n"
" - about 10 minutes\n"
" - don't forget to upload to the website\n"
"(1) read paper (79|2|60.0|reading,downtime|scopatz|1saefa)\n"
"------------------------------\n"
"Tasks (decreasing priority going up)\n"
"------------------------------\n"
"(2)(79 days): (1) read paper (79|2|60.0|reading,downtime|scopatz|1saefa)\n"
"----------------------------------------------------------------------------\n"
"(importance)(days to due): (Task number) Task (decreasing priority going up)\n"
"----------------------------------------------------------------------------\n"
"2020-07-19(79 days): (1) read paper (79|2|60.0|reading,downtime|scopatz|1saefa)\n"
"------------------------------\n"
"Deadlines:\n"
Expand All @@ -388,10 +388,10 @@
"(index) action (days to due date|importance|expected duration (mins)|tags|assigned by)\n"
"--------------------------------------------------------------------------------\n"
"started:\n"
"(1) read paper (6|2|60.0|reading,downtime|scopatz|1saefa)\n"
"------------------------------\n"
"Tasks (decreasing priority going up)\n"
"------------------------------\n"
"(2)(6 days): (1) read paper (6|2|60.0|reading,downtime|scopatz|1saefa)\n"
"----------------------------------------------------------------------------\n"
"(importance)(days to due): (Task number) Task (decreasing priority going up)\n"
"----------------------------------------------------------------------------\n"
"2020-07-19(6 days): (1) read paper (6|2|60.0|reading,downtime|scopatz|1saefa)\n"
"------------------------------\n"
"Deadlines:\n"
Expand All @@ -404,12 +404,12 @@
"(index) action (days to due date|importance|expected duration (mins)|tags|assigned by)\n"
"--------------------------------------------------------------------------------\n"
"started:\n"
"(2) prepare the presentation (16|0|30.0|downtime|sbillinge|2saefa)\n"
"(0)(16 days): (2) prepare the presentation (16|0|30.0|downtime|sbillinge|2saefa)\n"
" - about 10 minutes\n"
" - don't forget to upload to the website\n"
"------------------------------\n"
"Tasks (decreasing priority going up)\n"
"------------------------------\n"
"----------------------------------------------------------------------------\n"
"(importance)(days to due): (Task number) Task (decreasing priority going up)\n"
"----------------------------------------------------------------------------\n"
"------------------------------\n"
"Deadlines:\n"
"------------------------------\n"
Expand All @@ -422,12 +422,12 @@
"(index) action (days to due date|importance|expected duration (mins)|tags|assigned by)\n"
"--------------------------------------------------------------------------------\n"
"started:\n"
"(2) prepare the presentation (-255|0|30.0|downtime|sbillinge|2saefa)\n"
"(0)(-255 days): (2) prepare the presentation (-255|0|30.0|downtime|sbillinge|2saefa)\n"
" - about 10 minutes\n"
" - don't forget to upload to the website\n"
"------------------------------\n"
"Tasks (decreasing priority going up)\n"
"------------------------------\n"
"----------------------------------------------------------------------------\n"
"(importance)(days to due): (Task number) Task (decreasing priority going up)\n"
"----------------------------------------------------------------------------\n"
"------------------------------\n"
"Deadlines:\n"
"------------------------------\n"
Expand Down Expand Up @@ -559,13 +559,13 @@
"(index) action (days to due date|importance|expected duration (mins)|tags|assigned by)\n"
"--------------------------------------------------------------------------------\n"
"started:\n"
"(2) prepare the presentation (16|0|30.0|downtime|sbillinge|2saefa)\n"
"(0)(16 days): (2) prepare the presentation (16|0|30.0|downtime|sbillinge|2saefa)\n"
" - about 10 minutes\n"
" - don't forget to upload to the website\n"
"(1) read paper (6|2|60.0|reading,downtime|scopatz|1saefa)\n"
"------------------------------\n"
"Tasks (decreasing priority going up)\n"
"------------------------------\n"
"(2)(6 days): (1) read paper (6|2|60.0|reading,downtime|scopatz|1saefa)\n"
"----------------------------------------------------------------------------\n"
"(importance)(days to due): (Task number) Task (decreasing priority going up)\n"
"----------------------------------------------------------------------------\n"
"2020-07-19(6 days): (1) read paper (6|2|60.0|reading,downtime|scopatz|1saefa)\n"
"------------------------------\n"
"Deadlines:\n"
Expand All @@ -590,18 +590,18 @@
"(index) action (days to due date|importance|expected duration (mins)|assigned by)\n"
"--------------------------------------------------------------------------------\n"
"started:\n"
"(2) prepare the presentation (16|0|30.0|downtime|sbillinge|2saefa)\n"
"(0)(16 days): (2) prepare the presentation (16|0|30.0|downtime|sbillinge|2saefa)\n"
" - about 10 minutes\n"
" - don't forget to upload to the website\n"
"finished:\n"
"(3) update the description (-7|2|35.0|tag1,tag2,newtag1,newtag2|sbillinge|test-u)\n"
"(2)(-7 days): (3) update the description (-7|2|35.0|tag1,tag2,newtag1,newtag2|sbillinge|test-u)\n"
" - test notes 1\n"
" - test notes 2\n"
" - some new notes\n"
" - notes2\n"
"------------------------------\n"
"Tasks (decreasing priority going up)\n"
"------------------------------\n"
"----------------------------------------------------------------------------\n"
"(importance)(days to due): (Task number) Task (decreasing priority going up)\n"
"----------------------------------------------------------------------------\n"
"2020-07-06(-7 days): (3) update the description (-7|2|35.0|tag1,tag2,newtag1,newtag2|sbillinge|test-u)\n"
" - test notes 1\n"
" - test notes 2\n"
Expand Down

0 comments on commit 86e2225

Please sign in to comment.