You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2018/03/24 15:38:17 UTC

[whimsy] branch master updated: don't add a committee to rotation if already present

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

rubys 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 5ea5a35  don't add a committee to rotation if already present
5ea5a35 is described below

commit 5ea5a354d61c2c841a0bac7cc453c54300c31c67
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Mar 24 11:37:42 2018 -0400

    don't add a committee to rotation if already present
    
    This can happen if there is a retry after a failure
---
 lib/whimsy/asf/committee.rb | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index e8ba343..d6d0574 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -222,7 +222,7 @@ module ASF
       # split into blocks
       blocks = contents.split("\n\n")
 
-      # find the reportings schedules
+      # find the reporting schedules
       index =  blocks.find_index {|section| section =~/January/}
 
       # extract reporting schedules
@@ -232,34 +232,36 @@ module ASF
         blocks[index+2].split("\n"),
       ]
 
-      # ensure that spacing is uniform
-      slots.each {|slot| slot.unshift '' unless slot[0] == ''}
+      unless slots.any? {|slot| slot.include? "    " + pmc}
+        # ensure that spacing is uniform
+        slots.each {|slot| slot.unshift '' unless slot[0] == ''}
 
-      # determine tie breakers between months of the same length
-      preference = [(date.month)%3, (date.month-1)%3, (date.month-2)%3]
+        # determine tie breakers between months of the same length
+        preference = [(date.month)%3, (date.month-1)%3, (date.month-2)%3]
 
-      # pick the month with the shortest list
-      slot = (0..2).map {|i| [slots[i].length, preference, i]}.min.last
+        # pick the month with the shortest list
+        slot = (0..2).map {|i| [slots[i].length, preference, i]}.min.last
 
-      # temporarily remove headers
-      headers = slots[slot].shift(3)
+        # temporarily remove headers
+        headers = slots[slot].shift(3)
 
-      # insert pmc into the reporting schedule
-      slots[slot] << "    " + pmc
+        # insert pmc into the reporting schedule
+        slots[slot] << "    " + pmc
 
-      # sort entries, case insensitive
-      slots[slot].sort_by!(&:downcase)
+        # sort entries, case insensitive
+        slots[slot].sort_by!(&:downcase)
 
-      #restore headers
-      slots[slot].unshift *headers
+        #restore headers
+        slots[slot].unshift *headers
 
-      # re-insert reporting schedules
-      blocks[index+0] = slots[0].join("\n")
-      blocks[index+1] = slots[1].join("\n")
-      blocks[index+2] = slots[2].join("\n")
+        # re-insert reporting schedules
+        blocks[index+0] = slots[0].join("\n")
+        blocks[index+1] = slots[1].join("\n")
+        blocks[index+2] = slots[2].join("\n")
 
-      # re-attach blocks
-      contents = blocks.join("\n\n")
+        # re-attach blocks
+        contents = blocks.join("\n\n")
+      end
 
       ########################################################################
       #         insert into COMMITTEE MEMBERSHIP AND CHANGE PROCESS          #

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.