<commit_before># frozen_string_literal: true

require_dependency "renalware/hd/base_controller"
require "collection_presenter"

module Renalware
  module HD
    class TransmissionLogsController < BaseController
      include PresenterHelper
      include Renalware::Concerns::Pageable

      def index
        logs = TransmissionLog.all.page(page).per(per_page)
        authorize logs
        render locals: { logs: logs }
      end
    end
  end
end<commit_msg>Don’t load the payload when displaying the log table<commit_after># frozen_string_literal: true

require_dependency "renalware/hd/base_controller"
require "collection_presenter"

module Renalware
  module HD
    class TransmissionLogsController < BaseController
      include PresenterHelper
      include Renalware::Concerns::Pageable

      # NB be sure not to select the payload as this will slow things down.
      # The payload is loaded by clicking on a link in the table
      def index
        logs = TransmissionLog
          .order(created_at: :desc)
          .select(TransmissionLog.attribute_names - [:payload])
          .page(page).per(per_page)
        authorize logs
        render locals: { logs: logs }
      end

      def show
        log = TransmissionLog.find(params[:id])
        authorize log
        respond_to do |format|
          format.xml { render xml: log.payload }
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.061472480343102216, 'fraction_numerical': 0.0, 'mean_word_length': 2.7735849056603774, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '529990', 'n_tokens_mistral': 393, 'n_tokens_neox': 378, 'n_words': 117}