Skip to content
Snippets Groups Projects

[add] unique user count to route statistics

Merged nar20 requested to merge issue/60-rota-statistics-usuarios-unicos into develop
1 file
+ 5
1
Compare changes
  • Side-by-side
  • Inline
@@ -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
Loading