mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 07:33:21 -05:00
Move RemoteId from transactions to splits
This is the more sensible location for it, since we import things on a per-account basis - so there can be more than one remote ID associated with a transaction, and the splits are the per-account portion of transactions anyway.
This commit is contained in:
parent
2deaf8ccb5
commit
905e30d87b
7
ofx.go
7
ofx.go
@ -44,8 +44,7 @@ func (i *OFXImport) AddTransaction(tran *ofxgo.Transaction, account *Account) er
|
||||
var t Transaction
|
||||
|
||||
t.Date = tran.DtPosted.UTC()
|
||||
t.RemoteId = tran.FiTID.String()
|
||||
// TODO CorrectFiTID/CorrectAction?
|
||||
|
||||
// Construct the description from whichever of the descriptive OFX fields are present
|
||||
if len(tran.Name) > 0 {
|
||||
t.Description = string(tran.Name)
|
||||
@ -80,6 +79,10 @@ func (i *OFXImport) AddTransaction(tran *ofxgo.Transaction, account *Account) er
|
||||
if account.SecurityId < 1 || account.SecurityId > int64(len(i.Securities)) {
|
||||
return errors.New("Internal error: security index not found in OFX import\n")
|
||||
}
|
||||
|
||||
s1.RemoteId = tran.FiTID.String()
|
||||
// TODO CorrectFiTID/CorrectAction?
|
||||
|
||||
security := i.Securities[account.SecurityId-1]
|
||||
s1.Amount = amt.FloatString(security.Precision)
|
||||
s2.Amount = amt.Neg(amt).FloatString(security.Precision)
|
||||
|
@ -34,9 +34,10 @@ type Split struct {
|
||||
AccountId int64
|
||||
SecurityId int64
|
||||
|
||||
Number string // Check or reference number
|
||||
Memo string
|
||||
Amount string // String representation of decimal, suitable for passing to big.Rat.SetString()
|
||||
RemoteId string // unique ID from server, for detecting duplicates
|
||||
Number string // Check or reference number
|
||||
Memo string
|
||||
Amount string // String representation of decimal, suitable for passing to big.Rat.SetString()
|
||||
}
|
||||
|
||||
func GetBigAmount(amt string) (*big.Rat, error) {
|
||||
@ -63,7 +64,6 @@ func (s *Split) Valid() bool {
|
||||
type Transaction struct {
|
||||
TransactionId int64
|
||||
UserId int64
|
||||
RemoteId string // unique ID from server, for detecting duplicates
|
||||
Description string
|
||||
Date time.Time
|
||||
Splits []*Split `db:"-"`
|
||||
|
Loading…
Reference in New Issue
Block a user