mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-12 07:51:08 -04:00
Store currency/security values/prices using big.Rat natively
This adds 'shadow' types used only by the store/db internal package whch handle converting these types to their DB-equivalent values. This change should allow reports to be generated significantly faster since it allows a large portion of the computation to be shifted to the database engines.
This commit is contained in:
@ -164,7 +164,11 @@ func ofxImportHelper(tx store.Tx, r io.Reader, user *models.User, accountid int6
|
||||
log.Print(err)
|
||||
return NewError(999 /*Internal Error*/)
|
||||
}
|
||||
split.Amount = r.FloatString(security.Precision)
|
||||
split.Amount.Rat = *r
|
||||
if split.Amount.Precision() > security.Precision {
|
||||
log.Printf("Precision on created imbalance-correction split (%d) greater than the underlying security (%s) allows (%d)", split.Amount.Precision(), security, security.Precision)
|
||||
return NewError(999 /*Internal Error*/)
|
||||
}
|
||||
split.SecurityId = -1
|
||||
split.AccountId = imbalanced_account.AccountId
|
||||
transaction.Splits = append(transaction.Splits, split)
|
||||
|
Reference in New Issue
Block a user