Offer aggregated RfC counts via API

This commit is contained in:
Maximilian Grundke
2018-04-24 14:08:07 +02:00
parent 4936d5d372
commit 4177e40edc
2 changed files with 45 additions and 1 deletions

View File

@ -29,11 +29,20 @@ class StatisticsController < ApplicationController
def rfc_activity
respond_to do |format|
format.json { render(json: rfc_activity_live_data) }
format.json { render(json: rfc_activity_data) }
end
end
def rfc_activity_history
respond_to do |format|
format.html { render 'rfc_activity_history' }
format.json do
range = params[:range] || 'year'
from = DateTime.strptime(params[:from], '%Y') rescue DateTime.new(0)
to = DateTime.strptime(params[:to], '%Y') rescue DateTime.now
render(json: ranged_rfc_data(range, from, to))
end
end
end
def authorize!