]> nos-oignons.net Git - gestion-adh.git/blobdiff - bin/update-ag-subscribers
Finish implenting update-ag-subscribers
[gestion-adh.git] / bin / update-ag-subscribers
index e5580c271fd86828173a865c1f1c234d07eea1d6..f10978ebc0fb26a5c657a4d6f722e48bf4a49281 100755 (executable)
@@ -7,3 +7,11 @@ Bundler.setup
 
 require 'nos_oignons/mailman'
 require 'nos_oignons/subscriptions'
+
+LIST = 'ag'
+
+current_emails = NosOignons::Mailman.list_members(LIST)
+uptodate_emails = NosOignons::Subscription.all.select(&:up_to_date?).collect(&:email)
+
+NosOignons::Mailman.add_members(LIST, uptodate_emails - current_emails)
+NosOignons::Mailman.remove_members(LIST, current_emails - uptodate_emails)