diff --git a/app/controllers/v1/statistics_controller.rb b/app/controllers/v1/statistics_controller.rb index 275499f3da23ee7e3175d8e51b9da7a4b8661807..16ae3e7915d1927d8b094de4ce36ae16aec4fd18 100644 --- a/app/controllers/v1/statistics_controller.rb +++ b/app/controllers/v1/statistics_controller.rb @@ -21,7 +21,7 @@ class V1::StatisticsController < ApplicationController # GET v1/statistics # GET v1/statistics.json def index - statistics = { count: count_learning_objects, month_publications: month_publications, month_downloads: month_downloads } + statistics = { count: count_learning_objects, month_publications: month_publications, month_downloads: month_downloads, unique_users: unique_users} render json: statistics end @@ -38,4 +38,8 @@ class V1::StatisticsController < ApplicationController def month_downloads Download.where('extract (month from created_at) = ? and extract (year from created_at) = ?', Time.current.month, Time.current.year).count end + + def unique_users + User.distinct.count + end end