X-Git-Url: https://nos-oignons.net/gitweb/gestion-adh.git/blobdiff_plain/9d982cb5d7f9abe598c8df3eefabe10501056110..a1ae7493cd715af233e04ac5204989db031c533e:/lib/nos_oignons.rb diff --git a/lib/nos_oignons.rb b/lib/nos_oignons.rb index 26ffdc6..ff387d1 100644 --- a/lib/nos_oignons.rb +++ b/lib/nos_oignons.rb @@ -26,8 +26,10 @@ module NosOignons current_emails = NosOignons::Mailman.list_members(list) uptodate_emails = NosOignons::Member.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) + emails_to_add = uptodate_emails - current_emails + NosOignons::Mailman.add_members(list, emails_to_add) unless emails_to_add.empty? + emails_to_remove = current_emails - uptodate_emails + NosOignons::Mailman.remove_members(list, emails_to_remove) unless emails_to_remove.empty? end def send_membership_reminders!