Forked from
PortalMEC / portalmec
1005 commits behind the upstream repository.
-
Bernardo Chagas authoredBernardo Chagas authored
statistics_controller.rb 584 B
class V1::StatisticsController < ApplicationController
def index
statistics = {:count => count_learning_objects, :month_publications => month_publications, :month_downloads => month_downloads}
render json: statistics
end
private
def count_learning_objects
LearningObject.where('state = ?', LearningObject.states[:published]).count
end
def month_publications
LearningObject.where('extract (month from published_at) = ? and extract (year from published_at) = ?', Time.now.month, Time.now.year).count
end
def month_downloads
end
end