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

curcuru 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 6d824a7e Normalize time handling; add some todos
6d824a7e is described below

commit 6d824a7e3eba50ce11a5ee4f4fec962181627f0e
Author: Shane Curcuru <[email protected]>
AuthorDate: Fri Jan 24 11:05:01 2025 -0500

    Normalize time handling; add some todos
---
 www/members/board-nominate.cgi    | 29 +++++++++++++++--------------
 www/members/board-nominations.cgi | 21 +++++++++++----------
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/www/members/board-nominate.cgi b/www/members/board-nominate.cgi
index 6429fc4c..d9ad2116 100755
--- a/www/members/board-nominate.cgi
+++ b/www/members/board-nominate.cgi
@@ -1,8 +1,7 @@
 #!/usr/bin/env ruby
-PAGETITLE = "Add entries to board nomination file" # Wvisible:tools
-# Note: PAGETITLE must be double quoted
-
+PAGETITLE = "Add entries to board_nominations.txt file" # Wvisible:meeting
 $LOAD_PATH.unshift '/srv/whimsy/lib'
+require 'time'
 require 'wunderbar'
 require 'wunderbar/bootstrap'
 require 'whimsy/asf'
@@ -12,9 +11,10 @@ require 'whimsy/asf/wunderbar_updates'
 require 'whimsy/asf/meeting-util'
 require 'whimsy/asf/time-utils'
 
+# Countdown until nominations for current meeting close
 t_now = Time.now.to_i
-t_end = ASF::MeetingUtil.nominations_close
-nomclosed = t_now > DateTime.parse(t_end).to_s.to_i
+t_end = Time.parse(ASF::MeetingUtil.nominations_close).to_i
+nomclosed = t_now > t_end
 
 def emit_form(title, prev_data)
   _whimsy_panel(title, style: 'panel-success') do
@@ -45,18 +45,18 @@ end
 def validate_form(formdata: {})
   uid = formdata['availid']
   chk = ASF::Person[uid]&.asf_member?
-  chk.nil? and return "Invalid availid: #{uid}"
+  chk.nil? and return "Invalid or non-Member availid: #{uid}"
   already = ASF::MemberFiles.board_nominees
   return "Already nominated: #{uid} by #{already[uid]['Nominated by']}" if 
already.include? uid
   return 'OK'
 end
 
-# Handle submission (checkout user's apacheid.json, write form data, checkin 
file)
+# Handle submission (checkout board_nominations.txt, write form data, checkin 
file)
 # @return true if we think it succeeded; false in all other cases
 def process_form(formdata: {}, wunderbar: {})
   statement = formdata['statement']
 
-  _h3 'Copy of statement to put in an email (if necessary)'
+  _h3 'Copy of nominators statement about the candidate'
   _pre statement
 
   _hr
@@ -82,20 +82,20 @@ _html do
       title: PAGETITLE,
       subtitle: 'About This Script',
       related: {
-        'board-nominations.cgi' => "Board nominations cross-check - ensuring 
nominations get on the ballot, etc.",
+        '/members/meeting' => 'Member Meeting FAQ and info',
+        'board-nominations.cgi' => 'Board nominations cross-check',
         ASF::SVN.svnpath!('Meetings') => 'Official Meeting Agenda Directory'
       },
       helpblock: -> {
-        _h3 'BETA - please report any errors to the Whimsy PMC!'
+        _h3 'BETA - please report any errors at private@whimsical!'
         _p %{
           This form can be used to ADD entries to the board-nominations.txt 
file.
-          This is currently for use by the Nominator only, and does not send a 
copy
+          This is currently for use by the Nominator only, and does not yet 
send a copy
           of the nomination to the members list.
-          There is currently no support for updating an existing entry.
+          There is no support for updating an existing entry.
         }
       }
     ) do
-
       if nomclosed
         _h1 'Nominations are now closed!'
       else
@@ -114,7 +114,8 @@ _html do
             end
           elsif valid == 'OK'
             if process_form(formdata: submission, wunderbar: _)
-              _p.lead "Thanks for Using This Form!"
+              _p.lead "Your nomination was submitted to svn."
+              # TODO Also send mail to members@ with this data (to complete 
process)
             else
               _div.alert.alert_warning role: 'alert' do
                 _p "SORRY! Your submitted form data failed process_form, 
please try again."
diff --git a/www/members/board-nominations.cgi 
b/www/members/board-nominations.cgi
index b9a3d2b1..8636677e 100755
--- a/www/members/board-nominations.cgi
+++ b/www/members/board-nominations.cgi
@@ -1,7 +1,6 @@
 #!/usr/bin/env ruby
 PAGETITLE = "Board nominations cross-check" # Wvisible:meeting
 $LOAD_PATH.unshift '/srv/whimsy/lib'
-
 require 'time'
 require 'erb'
 require 'wunderbar/bootstrap'
@@ -11,9 +10,10 @@ require 'whimsy/asf/meeting-util'
 require_relative '../../tools/parsemail'
 require 'whimsy/asf/time-utils'
 
+# Countdown until nominations for current meeting close
 t_now = Time.now.to_i
-t_end = ASF::MeetingUtil.nominations_close
-
+t_end = Time.parse(ASF::MeetingUtil.nominations_close).to_i
+nomclosed = t_now > t_end
 
 # link to members private-arch
 MBOX = 'https://mail-search.apache.org/members/private-arch/members/'
@@ -21,7 +21,7 @@ MBOX = 
'https://mail-search.apache.org/members/private-arch/members/'
 # link to roster page
 ROSTER = '/roster/committer'
 MEETINGS = ASF::SVN['Meetings']
-MAIL_ROOT = '/srv/mail' # TODO: this should be config item
+MAIL_ROOT = '/srv/mail' # TODO: this should be config item in config.rb
 # Only need these items
 Email = Struct.new(:subject, :date, :message_id, :from, :asciiname)
 
@@ -98,23 +98,24 @@ _html do
     _whimsy_body(
       title: PAGETITLE,
       related: {
-        'board-nominate.cgi' => "Add entries to board nomination file",
+        '/members/meeting' => 'Member Meeting FAQ and info',
+        'board-nominate.cgi' => "Nominate someone for director in 
board_nominations.txt",
         'nominations' => 'New Member nominations cross-check',
         ASF::SVN.svnpath!('Meetings') => 'Official Meeting Agenda Directory'
       },
       helpblock: -> {
         _ 'This script checks board nomination statements from members@ 
against the official meeting ballot files, and highlights differences. '
-        _ 'This probably only works in the period shortly before or after a 
Members meeting!'
+        _ 'This only works in the period shortly before or after a Members 
meeting!'
         _br
         _ 'Entries are highlighted if they are not present in both lists.'
       }
     ) do
-      if t_end > t_now
-        _h3 "Nominations close in #{ASFTime.secs2text(t_end - t_now)} at 
#{Time.at(t_end).utc}"
-        _p 'Please ensure all posted nominations are added to SVN before then.'
-      else
+      if nomclosed
         _h1 'Nominations are now closed!'
         _p 'Nominations must no longer be added to the nominations file'
+      else
+        _h3 "Nominations close in #{ASFTime.secs2text(t_end - t_now)} at 
#{Time.at(t_end).utc}"
+        _p 'Please ensure all posted nominations are added to 
board_nominations.txt before then.'
       end
       cur_mtg_dir = File.basename(ASF::MeetingUtil.get_latest(MEETINGS))
       nominations, emails = setup_data

Reply via email to