fix shared group member ids issue

This commit is contained in:
Radu Ioan Fericean
2015-03-12 13:35:06 +02:00
parent fbed64cd09
commit 79750c6374

View File

@@ -129,13 +129,15 @@ func (ub *Account) debitBalanceAction(a *Action, reset bool) error {
a.Balance.Value = -a.Balance.Value
a.Balance.dirty = true // Mark the balance as dirty since we have modified and it should be checked by action triggers
ub.BalanceMap[id] = append(ub.BalanceMap[id], a.Balance)
if a.Balance.SharedGroup != "" {
// add shared group member
sg, err := accountingStorage.GetSharedGroup(a.Balance.SharedGroup, false)
if err != nil || sg == nil {
//than problem
Logger.Warning(fmt.Sprintf("Could not get shared group: %v", a.Balance.SharedGroup))
} else {
}
if a.Balance.SharedGroup != "" {
// add shared group member
sg, err := accountingStorage.GetSharedGroup(a.Balance.SharedGroup, false)
if err != nil || sg == nil {
//than problem
Logger.Warning(fmt.Sprintf("Could not get shared group: %v", a.Balance.SharedGroup))
} else {
if !utils.IsSliceMember(sg.MemberIds, ub.Id) {
// add member and save
sg.MemberIds = append(sg.MemberIds, ub.Id)
accountingStorage.SetSharedGroup(sg)