1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-01 12:08:37 -04:00

imports: Don't re-import the same transaction from the same place

This is detected using the RemoteId field on Splits

While we're at it, also make gnucash import check numbers
This commit is contained in:
2017-06-10 15:22:13 -04:00
parent 8cb222a107
commit a4b99381d3
4 changed files with 46 additions and 10 deletions

View File

@ -61,6 +61,11 @@ func (s *Split) Valid() bool {
return err == nil
}
func (s *Split) AlreadyImportedTx(transaction *gorp.Transaction) (bool, error) {
count, err := transaction.SelectInt("SELECT COUNT(*) from splits where RemoteId=? and AccountId=?", s.RemoteId, s.AccountId)
return count == 1, err
}
type Transaction struct {
TransactionId int64
UserId int64