Calculating the total of users in a channel

This commit is contained in:
claudemiro
2015-01-15 07:52:23 -03:00
parent 5043b05c7b
commit 414c1d98ee
+7 -2
View File
@@ -73,9 +73,14 @@ func (c *Channel) TotalSubscriptions() int {
}
// Get the total of users.
// For now, totalUsers is equal to totalSubscribers
func (c *Channel) TotalUsers() int {
return c.TotalSubscriptions()
total := make(map[string]int)
for _, s := range c.Subscriptions {
total[s.Id]++
}
return len(total)
}
// Add a new subscriber to the channel