module ASF::Board
module which contains the Agenda
class
Utility methods for board agendas or meetings.
Constants
- DIRECTOR_MAP
- DISPLAY_NAME
- FIRST_NAME
- INITIALS
-
Map director ids->names and ids->initials Only filled in since 2007 or so, once the preapp data in meetings is parseable
- TIMEZONE
Public Class Methods
Source
# File lib/whimsy/asf/board.rb, line 50 def self.calendar svn = ASF::SVN.find('board') return [] unless svn txt = File.read(File.join(svn, 'calendar.txt')) times = txt.scan(/^\s+\*\)\s(.*)/).flatten times.map {|time| TIMEZONE.parse(time)} end
list of board meeting times as listed in committers/board/calendar.txt
Source
# File lib/whimsy/asf/board.rb, line 186 def self.directorDisplayName(id) DIRECTOR_MAP[id] && DIRECTOR_MAP[id][DISPLAY_NAME] end
Return the display name for the uid Fails if there is no entry, so check first using directorHasId?
Source
# File lib/whimsy/asf/board.rb, line 180 def self.directorFirstName(id) DIRECTOR_MAP[id] && DIRECTOR_MAP[id][FIRST_NAME] end
Return the first name for the uid Fails if there is no entry, so check first using directorHasId?
Source
# File lib/whimsy/asf/board.rb, line 168 def self.directorHasId?(id) DIRECTOR_MAP[id] end
Does the uid have an entry in the director initials table?
Source
# File lib/whimsy/asf/board.rb, line 174 def self.directorInitials(id) DIRECTOR_MAP[id] && DIRECTOR_MAP[id][INITIALS] end
Return the initials for the uid Fails if there is no entry, so check first using directorHasId?
Source
# File lib/whimsy/asf/board.rb, line 36 def self.directors(withId=false) if withId ASF::Service['board'].members. map {|person| [person.id, {name: person.public_name}]}. sort_by {|_id, hash| hash[:name].split(' ').rotate(-1)}.to_h else ASF::Service['board'].members. map(&:public_name). sort_by {|name| name.split(' ').rotate(-1)} end end
sorted list of Directors default to names only if withId == true, then return hash: { id: {name: public_name}} This allows for returning additional data such as start of tenure sort is by last name
Source
# File lib/whimsy/asf/board.rb, line 101 def self.lastMeeting next_meeting = self.nextMeeting time = self.calendar.select {|t| t < next_meeting}.max unless time require 'chronic' this_month = Time.now.strftime('%B') time ||= Chronic.parse("3rd wednesday in #{this_month}") if not time or time > Time.now.utc time = Chronic.parse('3rd wednesday last month') end time = TIMEZONE.parse("#{time.to_date} 21:30") end time end
time of previous meeting
Source
# File lib/whimsy/asf/board.rb, line 59 def self.nextMeeting time = self.calendar.select {|t| t > Time.now.utc}.min unless time # If time not found in calendar, then calculate it require 'chronic' this_month = Time.now.strftime('%B') time = Chronic.parse("3rd wednesday in #{this_month}") if not time or time < Time.now.utc time = Chronic.parse('3rd wednesday next month') end time = TIMEZONE.parse("#{time.to_date} 21:30") end time end
time of next meeting
Source
# File lib/whimsy/asf/board.rb, line 80 def self.nextQuarter qr = self.calendar.select {|t| t > Time.now.utc}.sort.first(3) h = qr.map {|d| [d.strftime('%B'), d]}.to_h h['Next'] = h.first[1] # Ruby hashes retain insertion order so this will be the next meeting h end
Next 3 meetings as hash, e.g. {July => date1, August => date2, September => date3, Next => date1} We assume dates don’t have to be calculated
Source
# File lib/whimsy/asf/board.rb, line 94 def self.nextReport(quarterdates, schedule) scfirst = schedule.first return quarterdates['Next'] if scfirst and ( scfirst.start_with?('Every') or scfirst.start_with?('Next') ) quarterdates[schedule.select {|s| nextQuarter[s]}.first] end
Get the next report date for a PMC or other committee Params: quarterdates - hash from nextQuarter schedule - list of report months (e.g. [“February”, “May”, “August”, “November”])
possibly preceeded by 'Next month: ...' or 'Every month'
Returns: the next date
Source
# File lib/whimsy/asf/board.rb, line 122 def self.reporting(meeting) month = meeting.strftime('%B') ASF::Committee.load_committee_info ASF::Committee.pmcs.select do |pmc| pmc.report == 'Every month' or pmc.report.start_with? 'Next month' or pmc.report.split(', ').include? month end end
list of PMCs reporting in the specified meeting
Source
# File lib/whimsy/asf/board.rb, line 12 def self.tzlink(time) # build full time zone link path = '/worldclock/fixedtime.html?iso=' + time.strftime('%Y-%m-%dT%H:%M:%S') + '&msg=ASF+Board+Meeting' # path += '&p1=137' # time zone for PST/PDT locality link = "http://www.timeanddate.com/#{path}" # try to shorten time zone link begin shorten = 'http://www.timeanddate.com/createshort.html?url=' + CGI.escape(path) + '&confirm=1' shorten = URI.parse(shorten).read[/id=selectable>(.*?)</, 1] link = shorten if shorten end link end
Convert a time to a timeanddate link, shortened if possible. Note: the path must be adjusted if the TIMEZONE
changes.