Hi Sebb, Looks like you beat me to it and implemented my suggestion without even seeing it. ;-)
Teamwork. Craig > On Jul 11, 2020, at 5:38 PM, Craig Russell <apache....@gmail.com> wrote: > > Well, the relevant code [1] is not included in the roster memstat code. So > using roster, moving members from/to Active/Emeritus does not result in > proper counts or having the entry in the proper place in the members.txt file. > > So where does this code belong? It should probably live in a library file > somewhere. Perhaps in whimsy/lib/whimsy/asf/members.rb in the Person class? > > Craig > > [1] > # update members.txt > pattern = /^Active.*?^=+\n+(.*?)^Emeritus/m > members_txt = open(dest).read > data = members_txt.scan(pattern).flatten.first > members = data.split(/^\s+\*\)\s+/) > members.shift > members.push @entry > members_txt[pattern,1] = " *) " + members.join("\n *) ") > members_txt[/We now number (\d+) active members\./,1] = members.length.to_s > File.write(dest, ASF::Member.sort(members_txt)) > >> On Jul 10, 2020, at 8:37 PM, Craig Russell <apache....@gmail.com >> <mailto:apache....@gmail.com>> wrote: >> >> Cool. So how does this code get called from memstat.json.rb? >> >>> On Jul 10, 2020, at 2:53 PM, Sam Ruby <ru...@intertwingly.net >>> <mailto:ru...@intertwingly.net>> wrote: >>> >>> On Fri, Jul 10, 2020 at 5:34 PM Craig Russell <apache....@gmail.com >>> <mailto:apache....@gmail.com>> wrote: >>>> >>>> I cannot find where the magic happens that updates the active member count >>>> in members.txt. >>>> >>>> When moving from active to emeritus: >>>> index = text.index(/^\s\*\)\s/, text.index(/^Emeritus/)) >>>> >>>> When moving from emeritus to active: >>>> index = text.index(/^\s\*\)\s/, text.index(/^Active/)) >>>> >>>> When moving from active to deceased: >>>> index = text.index(/^\s\*\)\s/, text.index(/^Deceased/)) >>>> >>>> And then, adding the entry back: >>>> text.insert index, entry >>> >>> https://github.com/apache/whimsy/blob/d0aa149dae6b02373ec5df020a4e042149bc745e/www/secretary/workbench/views/actions/memapp.json.rb#L104-L105 >>> >>> <https://github.com/apache/whimsy/blob/d0aa149dae6b02373ec5df020a4e042149bc745e/www/secretary/workbench/views/actions/memapp.json.rb#L104-L105> >>> >>> I highlighted two lines. The first will update the membership count. >>> The second will sort member names. >>> >>>> Craig L Russell >>>> c...@apache.org <mailto:c...@apache.org> >>> >>> - Sam Ruby >> >> Craig L Russell >> c...@apache.org <mailto:c...@apache.org> >> > > Craig L Russell > c...@apache.org <mailto:c...@apache.org> > Craig L Russell c...@apache.org