From 0c3d73dc2b1de4d19c2bdadba9516d5ab1a9a655 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Mon, 12 Aug 2024 10:52:51 -0500 Subject: [PATCH] Add debug logging when changing the state of an issue. --- pit.nimble | 2 +- src/pitpkg/cliconstants.nim | 2 +- src/pitpkg/private/libpit.nim | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pit.nimble b/pit.nimble index 3a159d7..6477d37 100644 --- a/pit.nimble +++ b/pit.nimble @@ -1,6 +1,6 @@ # Package -version = "4.25.1" +version = "4.25.2" author = "Jonathan Bernard" description = "Personal issue tracker." license = "MIT" diff --git a/src/pitpkg/cliconstants.nim b/src/pitpkg/cliconstants.nim index 09b0e52..81bb6cd 100644 --- a/src/pitpkg/cliconstants.nim +++ b/src/pitpkg/cliconstants.nim @@ -1,4 +1,4 @@ -const PIT_VERSION* = "4.25.1" +const PIT_VERSION* = "4.25.2" const USAGE* = """Usage: pit ( new | add) [] [options] diff --git a/src/pitpkg/private/libpit.nim b/src/pitpkg/private/libpit.nim index f86ad8c..0d83b6a 100644 --- a/src/pitpkg/private/libpit.nim +++ b/src/pitpkg/private/libpit.nim @@ -328,11 +328,16 @@ proc loadAllIssues*(tasksDir: string): TableRef[IssueState, seq[Issue]] = for state in IssueState: result[state] = tasksDir.loadIssues(state) proc changeState*(issue: Issue, tasksDir: string, newState: IssueState) = + var dbgInfo = "[$#] changing state: $# → $#" % + [ ($issue.id)[0..<6], $issue.state, $newState ] + let oldFilepath = issue.filepath if newState == Done: issue.setDateTime("completed", getTime().local) tasksDir.store(issue, newState) if oldFilePath != issue.filepath: removeFile(oldFilepath) + dbgInfo &= "\n\told path: $#\n\tnew path: $#" % [oldFilePath, issue.filepath] issue.state = newState + debug dbgInfo proc delete*(issue: Issue) = removeFile(issue.filepath)