Compare commits

..

3 Commits

Author SHA1 Message Date
a28f1540c4 Don't worry about missing pit issues if the Trello card is completed.
This is a normal case when you go a really long time without syncing and
the issues fall off of the pit time horizon.

Also, bump versions to support Nim 2.x
2024-11-30 08:11:51 -06:00
f8e39d60f6 Pin Nim version using asdf. 2024-08-05 08:00:26 -05:00
208bdab1e4 Don't worry about missing Trello cards if the issue is completed.
This is a normal case when Trello lists or cards are archived.
2023-12-15 22:16:28 -06:00
4 changed files with 20 additions and 14 deletions

1
.tool-versions Normal file
View File

@ -0,0 +1 @@
nim 2.2.0

View File

@ -1,6 +1,6 @@
# Package # Package
version = "0.2.1" version = "0.2.3"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Synchronization tool between JDB pit and Trello." description = "Synchronization tool between JDB pit and Trello."
license = "MIT" license = "MIT"
@ -19,8 +19,8 @@ requires @[
# Dependencies from git.jdb-software.com/jdb/nim-packages # Dependencies from git.jdb-software.com/jdb/nim-packages
requires @[ requires @[
"cliutils >= 0.8.1", "cliutils >= 0.9.1",
"pit >= 4.23.3", "pit >= 4.26.0",
"timeutils", "timeutils",
"update_nim_package_version" "update_nim_package_version"
] ]

View File

@ -102,10 +102,8 @@ proc syncContext(
let board = s.boards[ctx.boardId] let board = s.boards[ctx.boardId]
var issueFilter = initFilter() let issues = s.issues.find(
issueFilter.completedRange = some((now() - 60.days, now())) propsFilter(newTable([("context", ctx.context)])))
issueFilter.properties = newTable([("context", ctx.context)])
let issues = s.issues.find(issueFilter)
let cards: seq[tuple[list: TrelloListSummary, card: TrelloCard]] = let cards: seq[tuple[list: TrelloListSummary, card: TrelloCard]] =
board.lists.pairs.toSeq --> board.lists.pairs.toSeq -->
@ -128,6 +126,9 @@ proc syncContext(
let foundCard = cards --> find(it.card.id == cardId) let foundCard = cards --> find(it.card.id == cardId)
if foundCard.isNone: if foundCard.isNone:
## Ignore issues that are completed (may be archived in Trello)
if i.state == Done: unmatchedIssueIds.excl($i.id)
else:
raise newException(Exception, raise newException(Exception,
"pit issue " & ($i.id)[0..6] & " references a Trello card with id " & "pit issue " & ($i.id)[0..6] & " references a Trello card with id " &
cardId & " but that card is not any of the lists of the " & cardId & " but that card is not any of the lists of the " &
@ -191,6 +192,11 @@ proc syncContext(
for (list, lentCard) in unmatchedCards: for (list, lentCard) in unmatchedCards:
let (list, card) = (list, lentCard) let (list, card) = (list, lentCard)
let issueState = issueStateForListCategory(list.category)
# Don't worry about creating new issues for cards that are done.
if issueState == Done: continue
let issue = Issue( let issue = Issue(
id: genUUID(), id: genUUID(),
summary: card.name, summary: card.name,
@ -204,7 +210,6 @@ proc syncContext(
filter(it.isSome). filter(it.isSome).
map(it.get)) map(it.get))
let issueState = issueStateForListCategory(list.category)
if not dryRun: s.pit.tasksDir.store(issue, issueState) if not dryRun: s.pit.tasksDir.store(issue, issueState)
info "pit created: " & formatSectionIssue(issue, width = 64) & " " & info "pit created: " & formatSectionIssue(issue, width = 64) & " " &
$issueState $issueState

View File

@ -1,4 +1,4 @@
const PIT2TRELLO_VERSION* = "0.2.1" const PIT2TRELLO_VERSION* = "0.2.3"
const USAGE* = """ const USAGE* = """
Usage: Usage: