Sha256: 83f5f7ffd191f715878ac9162cc4f9764b0b04e66ae94fc4efaf2b4c75e4eff9

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

module Federails
  module Server
    class NodeinfoController < Federails::ServerController
      def index
        skip_authorization

        render formats: [:nodeinfo]
      end

      def show # rubocop:todo Metrics/AbcSize
        skip_authorization

        @total = @active_halfyear = @active_month = 0
        @has_user_counts = false
        Federails::Configuration.entity_types.each_value do |config|
          next unless (method = config[:user_count_method]&.to_sym)

          @has_user_counts = true
          model = config[:class]
          @total += model.send(method, nil)
          @active_month += model.send(method, ((30.days.ago)...Time.current))
          @active_halfyear += model.send(method, ((180.days.ago)...Time.current))
        end
        render formats: [:nodeinfo]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
federails-0.3.0 app/controllers/federails/server/nodeinfo_controller.rb