<commit_before>%h1= @campaign.name

-if @campaign.sent? || @campaign.sending?
  .row
    .col-md-9

      .panel.panel-default
        .panel-heading
          .panel-title
            =@campaign.subject
            -if @campaign.deliveries.any?
              .pull-right
                =link_to 'View', webview_campaign_path(@campaign.deliveries.last.key), target: '_blank'
          -if @campaign.deliveries.any?
            Sent on #{@campaign.deliveries.maximum(:sent_at).to_s(:long)}
          to #{@campaign.deliveries.count} unique subscribers in #{@campaign.mailing_list.name}

        .panel-body
          .row
            .col-md-9#opens-chart
              = line_chart campaign_path(@campaign, format: :json), library: {title: 'Opens over time'}


          .row
            .col-md-6
              %ul.list-unstyled
                %li
                  %h1 #{@campaign.opened_mails_count}
                  Opens so far
                %li
                  %h1 #{@campaign.unopened_count}
                  Not opened yet

            .col-md-3
              %ul.list-unstyled
                %li
                  %h1 #{number_to_percentage ((@campaign.hit_rate||0)*100), precision: 2, strip_insignificant_zeros: true}
                  Open rate
                %li
                  %h1 #{@campaign.complaints_count}
                  Complaints
            .col-md-3
              %ul.list-unstyled
                %li
                  %h1 #{@campaign.complaints_count}
                  Bounces
          .row
            %h1 Who Opened
            %table.table.table-striped
              %thead
                %tr
                  %th Who
                  %th Opened Count

              %tbody
                -@campaign.deliveries.where(opened: true).order('opens_count DESC').limit(50).each do |sub|
                  %tr
                    %td= sub.to
                    %td= sub.opens_count


-else
  .row
    .col-md-3
      .panel.panel-default
        .panel-heading
          Send a test campaign to...

        .panel-body
          = simple_form_for(@campaign, url: send_preview_campaign_path(@campaign), html: { class: "form"} ) do |f|
            =f.input :preview_recipients, hint: 'Enter e-mail addresses, separated by a comma'

            .form-actions
              =f.button :submit, "Send Preview Campaign"
<commit_msg>fix styling of campaign stats page<commit_after>%h1= @campaign.name

-if @campaign.sent? || @campaign.sending?
  .row
    .col-md-9

      .panel.panel-default
        .panel-heading
          .panel-title
            =@campaign.subject
            -if @campaign.deliveries.any?
              .pull-right
                =link_to 'View', webview_campaign_path(@campaign.deliveries.last.key), target: '_blank'
          -if @campaign.deliveries.any?
            Sent on #{@campaign.deliveries.maximum(:sent_at).to_s(:long)}
          to #{@campaign.deliveries.count} unique subscribers in #{@campaign.mailing_list.name}

        .panel-body
          .row
            .col-md-9#opens-chart
              = line_chart campaign_path(@campaign, format: :json), library: {title: 'Opens over time'}


          .row
            .col-md-6
              %ul.list-unstyled
                %li
                  %h1 #{@campaign.opened_mails_count}
                  Opens so far
                %li
                  %h1 #{@campaign.unopened_count}
                  Not opened yet

            .col-md-3
              %ul.list-unstyled
                %li
                  %h1 #{number_to_percentage ((@campaign.hit_rate||0)*100), precision: 2, strip_insignificant_zeros: true}
                  Open rate
                %li
                  %h1 #{@campaign.complaints_count}
                  Complaints
          .row
            .col-md-3
              %ul.list-unstyled
                %li
                  %h1 #{@campaign.bounces_count}
                  Bounces

          .row
            %h1 Who Opened
            %table.table.table-striped
              %thead
                %tr
                  %th Who
                  %th Opened Count

              %tbody
                -@campaign.deliveries.where(opened: true).order('opens_count DESC').limit(50).each do |sub|
                  %tr
                    %td= sub.to
                    %td= sub.opens_count


-else
  .row
    .col-md-3
      .panel.panel-default
        .panel-heading
          Send a test campaign to...

        .panel-body
          = simple_form_for(@campaign, url: send_preview_campaign_path(@campaign), html: { class: "form"} ) do |f|
            =f.input :preview_recipients, hint: 'Enter e-mail addresses, separated by a comma'

            .form-actions
              =f.button :submit, "Send Preview Campaign"

{'fraction_non_alphanumeric': 0.10666387259010897, 'fraction_numerical': 0.008382229673093043, 'mean_word_length': 1.2980259990370726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5880311', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1335, 'n_words': 280}