Cascade deleting

Fix bad note deleting when no ID specified
This commit is contained in:
2018-07-21 16:11:32 +02:00
parent f426b616fd
commit fa25b86a2d
3 changed files with 73 additions and 9 deletions

18
note.py
View File

@@ -55,7 +55,7 @@ def handle_note(args, last_action, conn):
if len(args) > 1:
delete_note(arg_number(args[1]), conn)
else:
delete_note(last_action.task_id, conn)
delete_note(last_action.note_id, conn)
else:
print(f"Invalid note option: {args[0]}")
@@ -137,6 +137,22 @@ def delete_note(note_id, conn):
record_action(cursor, TypeAction.DELETE, "", note_id=note_id)
print("deleted note {}: {}".format(note_id, "note_name"))
# TODO Good Output
# $ pit p -d
# deleted task 1: efzf (project: 1)
# deleted note 1: fzef (task 3)
# deleted note 2: efz (task 3)
# deleted task 3: efzfzefzef with 2 notes (project: 1)
# deleted note 4: gtrezgze (task 7)
# deleted note 5: fgzegfz (task 7)
# deleted task 7: test with 2 notes (project: 1)
# deleted task 9: a task (project: 1)
# deleted task 10: a task (project: 1)
# deleted note 6: test (task 11)
# deleted note 7: test (task 11)
# deleted note 8: test (task 11)
# deleted task 11: new name with 3 notes (project: 1)
# deleted project 1: test with 6 tasks
def list_note(active_project_id, active_task_id, active_note_id, conn):