<commit_before>-# frozen_string_literal: true

- sr = @query_command.search_results
= render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true}

%h2
  Search results

.search-summary
  %ul.search-terms.list-inline
    %li
      #{sr.summarise} by searching for:
    - @preferences.each_search_term do |search_term|
      %li.term
        %label
          = search_term.label
          - st_path = @preferences.as_path( :search, {}, {search_term.name => search_term.value } )
          %a.search-term{ href: st_path }
            %i.fa.fa-times-circle.fa-lg

  .search-selection
    Current selection:
    %strong #{results_selection_summary( @preferences.selected_limit )}.

    %span Select instead:
    - (UserPreferences::AVAILABLE_LIMITS - [@preferences.selected_limit]).each do |limit|
      %span
        = results_selection( limit, @preferences )

- if sr.max_results_limit_hit
  .search-limit-reached.bg-danger
    %i.fa.fa-exclamation-triangle
    We're sorry, but your search returned more results than is practical to display on this
    page without causing your browser to slow down. We have limited this page to
    #{SearchResults::DEFAULT_MAX_RESULTS} results. If you want to view all of the results
    that your search returned, please make the query more selective, or
    %strong
      %a{ href: "#{@preferences.as_path( :ppd_data )}"}
        download the data
    onto your computer.

%ul.list-unstyled.ppd-results
  - result = nil
  - sr.each_property_address do |results|
    - previous_result = result
    - result = results.first

    %li{}
      .row
        %h4.property-heading.col-md-12
          %span.address
            = result.formatted_address

      .row
        .col-md-4
          %table.table
            %thead
              %tr
                %th{colspan: 4}
                  Transaction history
              %tr.hidden
                %th
                  Transaction category
                %th
                  Date
                %th
                  Price
            %tbody
              - results.each do |result|
                %tr
                  %td
                    %span.transaction-category{title: result.formatted_transaction_category[:label]}
                      = result.formatted_transaction_category[:display]
                  %td
                    = result.value_of_property( "ppd:transactionDate" )
                  %td.text-right
                    = number_to_currency( result.value_of_property( "ppd:pricePaid" ), locale: "en", precision: 0, unit: "&pound;".html_safe )
                  %td.transaction-url
                    %a{ href: result.value_of_property("@id") }
                      %i.fa.fa-external-link

        .col-md-4.detailed-address
          %table.table
            %thead
              %tr
                %th{colspan: 2}
                  Detailed address
            %tbody
              - SearchResult::DETAILED_ADDRESS_ASPECTS.each do |aspect|
                %tr
                  = address_detail_header( aspect, result )
                  = address_detail_filter( aspect, result, @preferences )

        .col-md-4.property-characteristics
          %table.table
            %thead
              %tr
                %th{colspan: 2}
                  Attributes
            %tbody
              %tr
                %td.property-details-field-title
                  property type
                %td
                  = result.property_type[:label]
              %tr
                %td.property-details-field-title
                  estate type
                %td
                  = result.estate_type[:label]
              %tr
                %td.property-details-field-title
                  new build?
                %td
                  = result.new_build_yes_no

= render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true}
= render partial: "ppd/bookmark_modal"
= render partial: "ppd/help_modal"<commit_msg>Use correct method in view after refactoring<commit_after>-# frozen_string_literal: true

- sr = @query_command.search_results
= render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true}

%h2
  Search results

.search-summary
  %ul.search-terms.list-inline
    %li
      #{sr.summarise} by searching for:
    - @preferences.each_search_term do |search_term|
      %li.term
        %label
          = search_term.label
          - st_path = @preferences.as_path( :search, {}, {search_term.name => search_term.value } )
          %a.search-term{ href: st_path }
            %i.fa.fa-times-circle.fa-lg

  .search-selection
    Current selection:
    %strong #{results_selection_summary( @preferences.selected_limit )}.

    %span Select instead:
    - (UserPreferences::AVAILABLE_LIMITS - [@preferences.selected_limit]).each do |limit|
      %span
        = results_selection( limit, @preferences )

- if sr.max_results_limit_hit
  .search-limit-reached.bg-danger
    %i.fa.fa-exclamation-triangle
    We're sorry, but your search returned more results than is practical to display on this
    page without causing your browser to slow down. We have limited this page to
    #{SearchResults::DEFAULT_MAX_RESULTS} results. If you want to view all of the results
    that your search returned, please make the query more selective, or
    %strong
      %a{ href: "#{@preferences.as_path( :ppd_data )}"}
        download the data
    onto your computer.

%ul.list-unstyled.ppd-results
  - result = nil
  - sr.each_property_address do |results|
    - previous_result = result
    - result = results.first

    %li{}
      .row
        %h4.property-heading.col-md-12
          %span.address
            = result.formatted_address

      .row
        .col-md-4
          %table.table
            %thead
              %tr
                %th{colspan: 4}
                  Transaction history
              %tr.hidden
                %th
                  Transaction category
                %th
                  Date
                %th
                  Price
            %tbody
              - results.each do |result|
                %tr
                  %td
                    %span.transaction-category{title: result.formatted_transaction_category[:label]}
                      = result.formatted_transaction_category[:display]
                  %td
                    = result.value_of_property( "ppd:transactionDate" )
                  %td.text-right
                    = number_to_currency( result.value_of_property( "ppd:pricePaid" ), locale: "en", precision: 0, unit: "&pound;".html_safe )
                  %td.transaction-url
                    %a{ href: result.value_of_property("@id") }
                      %i.fa.fa-external-link

        .col-md-4.detailed-address
          %table.table
            %thead
              %tr
                %th{colspan: 2}
                  Detailed address
            %tbody
              - SearchResult::DETAILED_ADDRESS_ASPECTS.each do |aspect|
                %tr
                  = address_detail_header( aspect, result )
                  = address_detail_filter( aspect, result, @preferences )

        .col-md-4.property-characteristics
          %table.table
            %thead
              %tr
                %th{colspan: 2}
                  Attributes
            %tbody
              %tr
                %td.property-details-field-title
                  property type
                %td
                  = result.property_type[:label]
              %tr
                %td.property-details-field-title
                  estate type
                %td
                  = result.estate_type[:label]
              %tr
                %td.property-details-field-title
                  new build?
                %td
                  = result.new_build_formatted

= render partial: "ppd/workflow_action_buttons", locals: {no_results: true, no_print: true}
= render partial: "ppd/bookmark_modal"
= render partial: "ppd/help_modal"
{'fraction_non_alphanumeric': 0.09192825112107623, 'fraction_numerical': 0.0027404085700049826, 'mean_word_length': 1.5791840668165757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5514707', 'n_tokens_mistral': 2308, 'n_tokens_neox': 2181, 'n_words': 485}