<commit_before>= render 'heading'

- if @import.working?
  .progress.progress-striped.active
    #progress-text.progress-bar.progress-bar-green{ style: "width: #{@import.row_progress}%; min-width:5%" }

  :javascript
    var current_status = #{ json_escape @import.status.to_json };
    var delay = 2000;
    var previousCount = 0;
    function refreshOnStatusChange() {
      $.getJSON('#{administration_import_path(@import, format: :json)}', function(data) {
        if (data.status != current_status) {
          location.reload();
        } else {
          if (previousCount == data.completed_rows_in_stage) {
            delay *= 1.1;
          } else {
            delay = 2000;
          }
          previousCount = data.completed_rows_in_stage;
          setTimeout(refreshOnStatusChange, delay);
          $('#progress-text').html(
            data.completed_rows_in_stage
          ).css(
            'width',
            data.row_progress + '%'
          )
        }
      });
    }
    setTimeout(refreshOnStatusChange, delay);

.row
  .col-lg-4
    .box.box-info
      .box-body
        %table.table.table-no-top-border
          %tr
            %th= t('.table.filename')
            %td= @import.filename
          - if @import.person
            %tr
              %th= t('.table.person')
              %td= link_to @import.person.name, @import.person
          %tr
            %th= t('.table.created_at')
            %td= @import.created_at.to_s(:full)
          %tr
            %th= t('.table.completed_at')
            - if @import.completed_at
              %td= @import.completed_at.to_s(:full)
            - else
              %td
                %em= t('administration.imports.status.pending')
          - if @import.status_at_least?(:parsed)
            %tr
              %th= t('.table.rows')
              %td= @import.rows.count
          %tr
            %th= t('.table.match_strategy')
            %td= t(@import.match_strategy, scope: 'administration.imports.show.match_strategies', default: '') # notest
          %tr
            %th= t('.table.create_as_active')
            %td= t(@import.create_as_active?.to_s, scope: 'administration.imports.show.create_as_active', default: '') # notest

  .col-lg-8
    - if @import.status_at_least?('previewed')
      .box.box-info
        .box-header
          %h3.box-title
            = t('.stats.heading')
            - unless @import.complete?
              (#{t('administration.imports.status.pending')})
        .box-body
          %table.table
            %thead
              %tr
                %th
                %th= t('.table.people')
                %th= t('.table.families')
            %tr
              %td= t('.table.creates')
              %td
                = icon 'fa fa-circle text-green'
                = link_to @import.rows.created_person.count, created_person: true
              %td
                = icon 'fa fa-circle text-green'
                = link_to @import.rows.created_family.count, created_family: true
            %tr
              %td= t('.table.updates')
              %td
                = icon 'fa fa-circle text-yellow'
                = link_to @import.rows.updated_person.count, updated_person: true
              %td
                = icon 'fa fa-circle text-yellow'
                = link_to @import.rows.updated_family.count, updated_family: true
            %tr
              %td= t('.table.no_change')
              %td
                = icon 'fa fa-circle text-gray'
                = link_to @import.rows.unchanged_people.count, unchanged_people: true
              %td
                = icon 'fa fa-circle text-gray'
                = link_to @import.rows.unchanged_families.count, unchanged_families: true
            %tr
              %td= t('.table.errored')
              %td
                = icon 'fa fa-circle text-red'
                = link_to @import.rows.errored.count, errored: true
              %td


- if @import.status_at_least?('previewed')
  = pagination @rows

  %table.table
    %thead
      %tr
        %th= t('.table.person_id')
        %th= t('.table.person_first_name')
        %th= t('.table.person_last_name')
        %th= t('.table.person_matched')
        %th= t('.table.person_status')
        %th= t('.table.family_id')
        %th= t('.table.family_name')
        %th= t('.table.family_matched')
        %th= t('.table.family_status')
    %tbody
      - @rows.each do |row|
        - attrs = row.import_attributes_as_hash(real_attributes: true)
        %tr{ class: row.errored? ? 'text-red' : nil }
          %td= import_link_to(row.person)
          %td= attrs['first_name']
          %td= attrs['last_name']
          %td= t(row.matched_person_by, scope: 'administration.imports.matched_by', default: '') # notest
          %td= import_row_record_status(row, :person)
          %td= import_link_to(row.family)
          %td= attrs['family_name']
          %td= t(row.matched_family_by, scope: 'administration.imports.matched_by', default: '') # notest
          %td= import_row_record_status(row, :family)
        - if row.errored?
          %tr.details
            %td
            %td{ colspan: 8, title: row.import_attributes.inspect }
              %table.spaced-table
                %thead
                  %tr
                    %th= t('.errors_table.name')
                    %th= t('.errors_table.value')
                    %th= t('.errors_table.error')
                %tbody
                  - import_row_errors(row).each do |error|
                    %tr
                      %td= error[:name]
                      %td= error[:value].presence || t('.errors_table.blank_value')<commit_msg>Don't highlight entire row in red if errored<commit_after>= render 'heading'

- if @import.working?
  .progress.progress-striped.active
    #progress-text.progress-bar.progress-bar-green{ style: "width: #{@import.row_progress}%; min-width:5%" }

  :javascript
    var current_status = #{ json_escape @import.status.to_json };
    var delay = 2000;
    var previousCount = 0;
    function refreshOnStatusChange() {
      $.getJSON('#{administration_import_path(@import, format: :json)}', function(data) {
        if (data.status != current_status) {
          location.reload();
        } else {
          if (previousCount == data.completed_rows_in_stage) {
            delay *= 1.1;
          } else {
            delay = 2000;
          }
          previousCount = data.completed_rows_in_stage;
          setTimeout(refreshOnStatusChange, delay);
          $('#progress-text').html(
            data.completed_rows_in_stage
          ).css(
            'width',
            data.row_progress + '%'
          )
        }
      });
    }
    setTimeout(refreshOnStatusChange, delay);

.row
  .col-lg-4
    .box.box-info
      .box-body
        %table.table.table-no-top-border
          %tr
            %th= t('.table.filename')
            %td= @import.filename
          - if @import.person
            %tr
              %th= t('.table.person')
              %td= link_to @import.person.name, @import.person
          %tr
            %th= t('.table.created_at')
            %td= @import.created_at.to_s(:full)
          %tr
            %th= t('.table.completed_at')
            - if @import.completed_at
              %td= @import.completed_at.to_s(:full)
            - else
              %td
                %em= t('administration.imports.status.pending')
          - if @import.status_at_least?(:parsed)
            %tr
              %th= t('.table.rows')
              %td= @import.rows.count
          %tr
            %th= t('.table.match_strategy')
            %td= t(@import.match_strategy, scope: 'administration.imports.show.match_strategies', default: '') # notest
          %tr
            %th= t('.table.create_as_active')
            %td= t(@import.create_as_active?.to_s, scope: 'administration.imports.show.create_as_active', default: '') # notest

  .col-lg-8
    - if @import.status_at_least?('previewed')
      .box.box-info
        .box-header
          %h3.box-title
            = t('.stats.heading')
            - unless @import.complete?
              (#{t('administration.imports.status.pending')})
        .box-body
          %table.table
            %thead
              %tr
                %th
                %th= t('.table.people')
                %th= t('.table.families')
            %tr
              %td= t('.table.creates')
              %td
                = icon 'fa fa-circle text-green'
                = link_to @import.rows.created_person.count, created_person: true
              %td
                = icon 'fa fa-circle text-green'
                = link_to @import.rows.created_family.count, created_family: true
            %tr
              %td= t('.table.updates')
              %td
                = icon 'fa fa-circle text-yellow'
                = link_to @import.rows.updated_person.count, updated_person: true
              %td
                = icon 'fa fa-circle text-yellow'
                = link_to @import.rows.updated_family.count, updated_family: true
            %tr
              %td= t('.table.no_change')
              %td
                = icon 'fa fa-circle text-gray'
                = link_to @import.rows.unchanged_people.count, unchanged_people: true
              %td
                = icon 'fa fa-circle text-gray'
                = link_to @import.rows.unchanged_families.count, unchanged_families: true
            %tr
              %td= t('.table.errored')
              %td
                = icon 'fa fa-circle text-red'
                = link_to @import.rows.errored.count, errored: true
              %td


- if @import.status_at_least?('previewed')
  = pagination @rows

  %table.table
    %thead
      %tr
        %th= t('.table.person_id')
        %th= t('.table.person_first_name')
        %th= t('.table.person_last_name')
        %th= t('.table.person_matched')
        %th= t('.table.person_status')
        %th= t('.table.family_id')
        %th= t('.table.family_name')
        %th= t('.table.family_matched')
        %th= t('.table.family_status')
    %tbody
      - @rows.each do |row|
        - attrs = row.import_attributes_as_hash(real_attributes: true)
        %tr
          %td= import_link_to(row.person)
          %td= attrs['first_name']
          %td= attrs['last_name']
          %td= t(row.matched_person_by, scope: 'administration.imports.matched_by', default: '') # notest
          %td= import_row_record_status(row, :person)
          %td= import_link_to(row.family)
          %td= attrs['family_name']
          %td= t(row.matched_family_by, scope: 'administration.imports.matched_by', default: '') # notest
          %td= import_row_record_status(row, :family)
        - if row.errored?
          %tr.details
            %td
            %td{ colspan: 8, title: row.import_attributes.inspect }
              %table.spaced-table
                %thead
                  %tr
                    %th= t('.errors_table.name')
                    %th= t('.errors_table.value')
                    %th= t('.errors_table.error')
                %tbody
                  - import_row_errors(row).each do |error|
                    %tr
                      %td= error[:name]
                      %td= error[:value].presence || t('.errors_table.blank_value')
{'fraction_non_alphanumeric': 0.13223213497040898, 'fraction_numerical': 0.0028266054235491565, 'mean_word_length': 1.5808069295646228, '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': '1362129', 'n_tokens_mistral': 3480, 'n_tokens_neox': 3336, 'n_words': 602}