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


The following commit(s) were added to refs/heads/master by this push:
     new bfced022 Use the library method for parsing
bfced022 is described below

commit bfced022d0ca955c21cf6415be56e59571e515a3
Author: Sebb <[email protected]>
AuthorDate: Tue Mar 12 14:52:09 2024 +0000

    Use the library method for parsing
---
 www/secretary/workbench/views/memapp.json.rb | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/www/secretary/workbench/views/memapp.json.rb 
b/www/secretary/workbench/views/memapp.json.rb
index 02001b9a..919d9dc2 100644
--- a/www/secretary/workbench/views/memapp.json.rb
+++ b/www/secretary/workbench/views/memapp.json.rb
@@ -1,22 +1,13 @@
+require 'whimsy/asf/meeting-util'
+
 # parse and return the contents of the latest memapp-received file
 
-# find latest memapp-received.txt file in the foundation/Meetings directory
-meetings = ASF::SVN['Meetings']
-received = Dir["#{meetings}/2*/memapp-received.txt"].max
+hoursremain = ASF::MeetingUtil.application_time_remaining[:hoursremain]
 
-# extract contents
-# Sample
-# Invite? Applied? members@? Karma? ID              Name
-# ------- -------- --------- ------ --------------- ------------------
-# yes     no       no        no     user-id_        User name
-# N.B. user id can contain - and _
-pattern = /^(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+([a-z][a-z_0-9-]+)\s+(.*?)\s*\n/
-if Date.today - Date.parse(received[/\d{8}/]) <= 32
-  table = File.read(received).scan(pattern)
+if hoursremain > 0 # Not yet expired
+  table = ASF::MeetingUtil.parse_memapp_to_h.sort_by{|k| k[:name]}
 else
   table = []
 end
 
-# map contents to a hash
-fields = %w(invite apply mail karma id name)
-{received: table.map {|results| fields.zip(results).to_h}.sort_by {|k| 
k['name']}}
+{received: table}

Reply via email to