Action bug fixup, fix cost field in stor db

This commit is contained in:
DanB
2013-10-08 11:57:06 +02:00
parent c59dc78f01
commit b7a87d1e59
2 changed files with 5 additions and 2 deletions

View File

@@ -12,8 +12,8 @@ CREATE TABLE `cost_details` (
`account` varchar(128) NOT NULL,
`subject` varchar(128) NOT NULL,
`destination` varchar(128) NOT NULL,
`cost` DECIMAL(5,4) NOT NULL,
`connect_fee` DECIMAL(5,4) NOT NULL,
`cost` double(20,4) NOT NULL,
`connect_fee` double(20,4) NOT NULL,
`timespans` text,
`source` varchar(64) NOT NULL,
PRIMARY KEY (`id`),

View File

@@ -119,6 +119,9 @@ func resetPrepaidAction(ub *UserBalance, a *Action) (err error) {
}
func topupResetAction(ub *UserBalance, a *Action) (err error) {
if ub.BalanceMap == nil { // Init the map since otherwise will get error if nil
ub.BalanceMap = make(map[string]BalanceChain, 0)
}
ub.BalanceMap[a.BalanceId+a.Direction] = BalanceChain{&Balance{Value: 0}} // ToDo: can ub be empty here?
genericMakeNegative(a)
genericDebit(ub, a)