%h1= @newsletter.title
%table.table
  %tr
    %th Date d'envoi
    %th Nombre de messages envoyés
    %th Nombre de messages lus
    %th Nombre de messages non-lus

  %tr
    %td=l @archive_newsletter.created_at
    %td=mail_send = @archive_newsletter.mail_archives.count()
    %td
      =mail_read = @archive_newsletter.mail_archives.where(:readed => true).count()
      -if mail_send > 0
        ="("
        =number_to_percentage (100.0*mail_read)/mail_send, :precision => 1
        =")"
    %td
      =mail_no_read = mail_send - mail_read
      -if mail_send > 0
        ="("
        = number_to_percentage((100.0*mail_no_read)/mail_send, :precision => 1)
        =")"
%h3 Liste des mails n'ayant pas reçu la newsletter
%table.table  
  -@archive_newsletter.mail_archives.where("readed != 1 or readed is null").all.each do |mail_archive|
    %tr
      %td
        =mail_archive.email
      %td
      
     

%h3 Liste des mails ayant reçu la newsletter
%table.table  
  -@archive_newsletter.mail_archives.where("readed = 1").all.each do |mail_archive|
    %tr
      %td
        =mail_archive.email
      %td
      
    