use map for shared group member ids

This commit is contained in:
Radu Ioan Fericean
2016-01-12 20:32:43 +02:00
parent f62d18171b
commit 834c12f8fa
7 changed files with 71 additions and 19 deletions

View File

@@ -40,7 +40,7 @@ const (
type SharedGroup struct {
Id string
AccountParameters map[string]*SharingParameters
MemberIds []string
MemberIds utils.StringMap
//members []*Account // accounts caching
}
@@ -92,7 +92,7 @@ func (sg *SharedGroup) SortBalancesByStrategy(myBalance *Balance, bc BalanceChai
// Returns all shared group's balances collected from user accounts'
func (sg *SharedGroup) GetBalances(destination, category, direction, balanceType string, ub *Account) (bc BalanceChain) {
// if len(sg.members) == 0 {
for _, ubId := range sg.MemberIds {
for ubId := range sg.MemberIds {
var nUb *Account
if ubId == ub.Id { // skip the initiating user
nUb = ub