Sha256: 95cb1d9cbec3f1d5e07feb3930722727d04e74af204de330108dd38b67c7b573
Contents?: true
Size: 578 Bytes
Versions: 11
Compression:
Stored size: 578 Bytes
Contents
module ForemanStatistics class StatisticsController < ::ApplicationController before_action :find_stat, :only => [:show] def index render :json => { :charts => charts.map(&:metadata) } end def show render :json => @stat.metadata.merge(:data => @stat.calculate.map(&:values)) end private def find_stat @stat = charts.detect { |ch| ch.id.to_s == params[:id] } @stat || not_found end def charts ForemanStatistics::Statistics.charts(Organization.current.try(:id), Location.current.try(:id)) end end end
Version data entries
11 entries across 11 versions & 1 rubygems