Sha256: 0779af77efea36fc42d8ebe90307190525aa7461f92c2b822292b3577a141bce

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

# Controller for Check Status header menu item
module QaServer
  class CheckStatusController < AuthorityValidationController

    ALL_AUTHORITIES = '__all__'.freeze

    class_attribute :presenter_class
    self.presenter_class = CheckStatusPresenter

    # Sets up presenter with data to display in the UI
    def index
      validate(authorities_to_validate, validation_type)
      @presenter = presenter_class.new(authorities_list: authorities_list,
                                       connection_status_data: connection_status_data_from_log,
                                       accuracy_status_data: accuracy_status_data_from_log)
    end

    private

      def connection_status_data_from_log
        status_log.filter(type: validator_class::VALIDATE_CONNECTIONS)
      end

      def accuracy_status_data_from_log
        status_log.filter(type: validator_class::VALIDATE_ACCURACY)
      end

      def authorities_to_validate
        return [] unless authority_name.present?
        (authority_name == ALL_AUTHORITIES) ? authorities_list : [authority_name]
      end

      def authority_name
        return @authority_name if @authority_name.present?
        @authority_name = (params.key? :authority) ? params[:authority].downcase : nil
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qa_server-0.1.99 app/controllers/qa_server/check_status_controller.rb