Sha256: 0546f8d3f3fe575dfc43a838d8acbb1ea9773d51a0a00a5b6f4b838d3b40d346

Contents?: true

Size: 816 Bytes

Versions: 6

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  module Analytics
    # Display Analytics
    class DashboardComponent < ViewComponent::Base
      attr_reader :current_exhibit, :dates

      def initialize(current_exhibit:)
        super
        @current_exhibit = current_exhibit
        @dates = { 'start_date' => '365daysAgo', 'end_date' => 'today' }
      end

      def results?
        page_analytics.totals.to_h.present? || search_analytics.totals.to_h.present?
      end

      def page_url
        @page_url ||= helpers.exhibit_root_path(current_exhibit)
      end

      def page_analytics
        @page_analytics ||= current_exhibit.page_analytics(dates, page_url)
      end

      def search_analytics
        @search_analytics ||= current_exhibit.analytics(dates, page_url)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-spotlight-4.3.1 app/components/spotlight/analytics/dashboard_component.rb
blacklight-spotlight-4.3.0 app/components/spotlight/analytics/dashboard_component.rb
blacklight-spotlight-4.2.0 app/components/spotlight/analytics/dashboard_component.rb
blacklight-spotlight-4.1.2 app/components/spotlight/analytics/dashboard_component.rb
blacklight-spotlight-4.1.1 app/components/spotlight/analytics/dashboard_component.rb
blacklight-spotlight-4.1.0 app/components/spotlight/analytics/dashboard_component.rb