-
Notifications
You must be signed in to change notification settings - Fork 18
Developer's Guide
There are 2 pages on admin panel which are full of charts for location based and nooks based statistics respectively. The page and the data is served through location_statistics_controller.rb
and nook_statistics_controller.rb
resp. Each page has a filter on top of it. On it's update the charts also get updated.
Both the controllers have a filter function which fetch the records according to the filter parameters sent from the user through page. This filter is applied before_filter
to fetch
and download
function.
The controllers have following functions:
- Index - to render the initial page
- Fetch - send the data as JSON to the page. Note that the records have already been fetched from the DB according to the filter parameters by
filter
funciton. - Download - send a CSV file with the records.
The charts are rendered using scripts from app/javascripts/administrate/charts
.
The canvas_heatmap.js renders all the charts on HTML canvas instead of in the SVG formats. This gives better performance in terms of rendering time.
The rest of the files render different type of charts - please check the comments on the top of the file for more info on what they render and the interpretation of the axes.
GoogleUser is the model which corresponds to the user who register through GoogleAuth2. We use omniauth-google-oauth2
gem for this strategy. The GoogleUser model inherits from User model. User table contains an attribute called type - which is set to GoogleUser in case of registration through GoogleAuth2. This is called Single Table Inheritance (STI). In future, if a student user is to be implemented, please use the same.