X-Git-Url: https://nos-oignons.net/gitweb/gestion-adh.git/blobdiff_plain/4a99ae87e0f7fdd07d8820a724fbed1d8b2b5f36..61077092ef62b9f0780c2dce7ef249be0ce4c7e7:/bin/update-ag-subscribers diff --git a/bin/update-ag-subscribers b/bin/update-ag-subscribers index e5580c2..f10978e 100755 --- a/bin/update-ag-subscribers +++ b/bin/update-ag-subscribers @@ -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)