This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit ce01b818d5fea0e985c972fbe368c0ccb99bbb74
Author: Sebb <[email protected]>
AuthorDate: Fri Sep 10 17:01:46 2021 +0100

    Add summary counts
---
 www/roster/public_ldap_groups.rb | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/www/roster/public_ldap_groups.rb b/www/roster/public_ldap_groups.rb
index 8c77f3e..2d315c5 100644
--- a/www/roster/public_ldap_groups.rb
+++ b/www/roster/public_ldap_groups.rb
@@ -10,9 +10,15 @@
 #
 # {
 #   "lastTimestamp": "20160119171152Z", // most recent modifyTimestamp
+#   "group_count": 123,
+#   "roster_counts": {
+#     "name": 1,
+#     ///
+#   },
 #   "groups": {
 #     "abdera": {
 #       "modifyTimestamp": "20111204095436Z",
+#       "roster_count": 123,
 #       "roster": ["uid",
 #       ...
 #       ]
@@ -62,17 +68,18 @@ lastStamp = ''
 
 # Add the non-project entries from the groups
 ALREADY = projects.keys.map(&:name)
-groups.select{|g| EXTRAS.include? g.name}.each do |group,data|
+groups.select {|g| EXTRAS.include? g.name}.each do |group, data|
   next if ALREADY.include?(group.name)
   project = MyProject.new
   project.name = group.name
   project.createTimestamp = group.createTimestamp
   project.modifyTimestamp = group.modifyTimestamp
-  project.members = group.members.map{|p| MyPerson.new(p.name)}
+  project.members = group.members.map {|p| MyPerson.new(p.name)}
   project.owners = []
   projects[project] = []
 end
 
+roster_counts = Hash.new(0)
 projects.keys.sort_by(&:name).each do |project|
   next unless WANTED.include? project.name
   m = []
@@ -85,13 +92,17 @@ projects.keys.sort_by(&:name).each do |project|
   entries[project.name] = {
     createTimestamp: createTimestamp,
     modifyTimestamp: modifyTimestamp,
+    roster_count: m.size,
     roster: m
   }
+  roster_counts[project.name] = m.size
 end
 
 info = {
   # Is there a use case for the last createTimestamp ?
   lastTimestamp: lastStamp,
+  group_count: entries.size,
+  roster_counts: roster_counts,
   groups: entries,
 }
 

Reply via email to