When completing an issue, print info about any new issue created by recurrence.

This commit is contained in:
Jonathan Bernard 2021-09-21 10:14:49 -05:00
parent 7bccd83e23
commit df854f864c
4 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Package # Package
version = "4.16.0" version = "4.17.0"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Personal issue tracker." description = "Personal issue tracker."
license = "MIT" license = "MIT"

View File

@ -207,10 +207,13 @@ proc list(ctx: CliContext, filter: Option[IssueFilter], states: Option[seq[Issue
for state in states.get: for state in states.get:
ctx.loadIssues(state) ctx.loadIssues(state)
if filter.isSome: ctx.filterIssues(filter.get) if filter.isSome: ctx.filterIssues(filter.get)
# Show Done for just today if requested
if state == Done and showToday: if state == Done and showToday:
ctx.issues[Done] = ctx.issues[Done].filterIt( ctx.issues[Done] = ctx.issues[Done].filterIt(
it.hasProp("completed") and it.hasProp("completed") and
sameDay(getTime().local, it.getDateTime("completed"))) sameDay(getTime().local, it.getDateTime("completed")))
stdout.write ctx.formatSection(ctx.issues[state], state, "", verbose) stdout.write ctx.formatSection(ctx.issues[state], state, "", verbose)
trace "listing complete" trace "listing complete"
return return
@ -378,6 +381,9 @@ when isMainModule:
if issue.hasProp("recurrence") and issue.getRecurrence.isSome: if issue.hasProp("recurrence") and issue.getRecurrence.isSome:
let nextIssue = ctx.tasksDir.nextRecurrence(issue.getRecurrence.get, issue) let nextIssue = ctx.tasksDir.nextRecurrence(issue.getRecurrence.get, issue)
ctx.tasksDir.store(nextIssue, Todo) ctx.tasksDir.store(nextIssue, Todo)
info "created the next recurrence:"
stdout.writeLine ctx.formatIssue(nextIssue)
issue.changeState(ctx.tasksDir, targetState) issue.changeState(ctx.tasksDir, targetState)

View File

@ -315,8 +315,8 @@ proc nextRecurrence*(tasksDir: string, rec: Recurrence, defaultIssue: Issue): Is
let newProps = newTable[string,string]() let newProps = newTable[string,string]()
for k, v in baseIssue.properties: for k, v in baseIssue.properties:
if k != "created" and k != "completed": if k != "completed": newProps[k] = v
newProps[k] = v newProps["prev-recurrence"] = $baseIssue.id
result = Issue( result = Issue(
id: genUUID(), id: genUUID(),

View File

@ -1 +1 @@
const PIT_VERSION* = "4.16.0" const PIT_VERSION* = "4.17.0"