Skip to content

Commit ffc1e34

Browse files
authored
fix: skip transactions with existing categories (#61)
1 parent 5b96544 commit ffc1e34

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/worker/firefly.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,17 @@ func (f *fireflyAPI) checkAndUpdateTransaction(t structs.WhTransactionRead) erro
282282
}
283283
resultTransaction = updateResponse
284284
}
285+
286+
if resultTransaction.Attributes.Transactions[0].CategoryName != "" {
287+
log.Println(">> categories already set, not sending notification")
288+
return nil
289+
}
290+
285291
categories, err := f.getCategories()
286292
if err != nil {
287293
categories = []structs.CategoryRead{}
288294
log.Println("WARNING: could not retrieve category names:", err)
289295
}
290-
if len(categories) > 0 {
291-
log.Println(">> categories already set, not sending notification")
292-
return nil
293-
}
294296

295297
log.Println(">> Sending notification...")
296298
err = f.notifManager.NotifyNewTransaction(resultTransaction, f.fireflyBaseURL, categories)

0 commit comments

Comments
 (0)