mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 15:42:27 -05:00
Don't mismatch securities because of pointers
This bug could cause transactions from imports with multiple securities to end up pointing to the wrong securities.
This commit is contained in:
parent
93a05576b8
commit
ec2a9cbdd8
@ -69,7 +69,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i
|
|||||||
// Find matching existing securities or create new ones for those
|
// Find matching existing securities or create new ones for those
|
||||||
// referenced by the OFX import. Also create a map from placeholder import
|
// referenced by the OFX import. Also create a map from placeholder import
|
||||||
// SecurityIds to the actual SecurityIDs
|
// SecurityIds to the actual SecurityIDs
|
||||||
var securitymap = make(map[int64]*Security)
|
var securitymap = make(map[int64]Security)
|
||||||
for _, ofxsecurity := range itl.Securities {
|
for _, ofxsecurity := range itl.Securities {
|
||||||
// save off since ImportGetCreateSecurity overwrites SecurityId on
|
// save off since ImportGetCreateSecurity overwrites SecurityId on
|
||||||
// ofxsecurity
|
// ofxsecurity
|
||||||
@ -81,7 +81,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i
|
|||||||
log.Print(err)
|
log.Print(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
securitymap[oldsecurityid] = security
|
securitymap[oldsecurityid] = *security
|
||||||
}
|
}
|
||||||
|
|
||||||
if account.SecurityId != securitymap[importedAccount.SecurityId].SecurityId {
|
if account.SecurityId != securitymap[importedAccount.SecurityId].SecurityId {
|
||||||
|
Loading…
Reference in New Issue
Block a user