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 b432054f Add nextMeeting calculation (e.g. for reporter)
b432054f is described below

commit b432054f66d2cf0c3619f461e8b850affd570ecf
Author: Sebb <[email protected]>
AuthorDate: Fri Jul 4 18:41:19 2025 +0100

    Add nextMeeting calculation (e.g. for reporter)
---
 lib/whimsy/asf/board.rb             | 13 ++++++++++---
 www/roster/public_committee_info.rb |  9 +++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/board.rb b/lib/whimsy/asf/board.rb
index 6f7632e5..c5948015 100644
--- a/lib/whimsy/asf/board.rb
+++ b/lib/whimsy/asf/board.rb
@@ -59,7 +59,7 @@ module ASF
     def self.nextMeeting
       time = self.calendar.select {|t| t > Time.now.utc}.min
 
-      unless time
+      unless time # If time not found in calendar, then calculate it
         require 'chronic'
         this_month = Time.now.strftime('%B')
 
@@ -75,6 +75,12 @@ module ASF
       time
     end
 
+    # Next 3 meetings as hash, e.g. {July => date1, August => date2, September 
=> date3}
+    # We assume dates don't have to be calculated
+    def self.nextQuarter
+      self.calendar.select {|t| t > Time.now.utc}.sort.first(3).map {|d| 
[d.strftime('%B'), d]}.to_h
+    end
+
     # time of previous meeting
     def self.lastMeeting
       next_meeting = self.nextMeeting
@@ -101,8 +107,9 @@ module ASF
       month = meeting.strftime('%B')
       ASF::Committee.load_committee_info
       ASF::Committee.pmcs.select do |pmc|
-        pmc.report.split(', ').include? month or pmc.report == 'Every month' or
-        pmc.report.start_with? 'Next month'
+        pmc.report == 'Every month' or
+        pmc.report.start_with? 'Next month' or
+        pmc.report.split(', ').include? month
       end
     end
 
diff --git a/www/roster/public_committee_info.rb 
b/www/roster/public_committee_info.rb
index b898617b..a51962f1 100644
--- a/www/roster/public_committee_info.rb
+++ b/www/roster/public_committee_info.rb
@@ -61,10 +61,18 @@ info = {
   roster_counts: nil
 }
 
+nextQuarter = ASF::Board.nextQuarter # {June: date1, July: date2, ...}
+
 roster_counts = {}
 info[:committees] = committees.map {|committee|
   schedule = committee.schedule.to_s.split(/,\s*/)
   schedule.unshift committee.report if committee.report != committee.schedule
+  scfirst = schedule.first
+  if scfirst and ( scfirst.start_with?('Every') or scfirst.start_with?('Next') 
)
+    nextMeeting = nextQuarter.first[1] # The value
+  else
+    nextMeeting = nextQuarter[schedule.select {|s| nextQuarter[s]}.first]
+  end
   cname = committee.name.gsub(/[^-\w]/, '')
   data = {
     display_name: committee.display_name,
@@ -73,6 +81,7 @@ info[:committees] = committees.map {|committee|
     mail_list: committee.mail_list,
     established: committee.established,
     report: schedule,
+    nextMeeting: nextMeeting,
     # Convert {:name=>"Public Name", :id=>"availid"} to
     # "chair": { "availid": { "name": "Public Name" } }
     chair: committee.chairs.map {|chair| [chair[:id], {:name => 
chair[:name]}]}.to_h,

Reply via email to