Sha256: d5aeaf78e619ed7802871a2332433b36839f9b97fc524f4e9dde29b42f14c6f4

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

module Federails
  module Server
    class NodeinfoController < ServerController
      def index
        render formats: [:json]
      end

      def show # rubocop:todo Metrics/AbcSize
        @total = @active_halfyear = @active_month = 0
        Federails::Configuration.entity_types.each_value do |config|
          next unless config[:include_in_user_count]

          model = config[:class]
          @total += model.count
          @active_month += model.where(created_at: ((30.days.ago)...Time.current)).count
          @active_halfyear += model.where(created_at: ((180.days.ago)...Time.current)).count
        end
        render formats: [:json]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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