diff --git a/app/controllers/macs_controller.rb b/app/controllers/macs_controller.rb index 0aac527..c4f5afa 100644 --- a/app/controllers/macs_controller.rb +++ b/app/controllers/macs_controller.rb @@ -90,6 +90,7 @@ end # GET /macs/1.json def show @mac = Mac.find(params[:id]) + @mac_logs = MacLog.where(:mac => @mac.mac) respond_to do |format| format.html # show.html.erb diff --git a/app/controllers/statistics_controller.rb b/app/controllers/statistics_controller.rb index 61b1e5d..3b33c90 100644 --- a/app/controllers/statistics_controller.rb +++ b/app/controllers/statistics_controller.rb @@ -17,7 +17,7 @@ class StatisticsController < ApplicationController } @door_log_graph = [] - @door_logs.group_by{|l| l.created_at.beginning_of_day}.each{|l| @door_log_graph << [l.first.to_time.to_i*1000,l.last.size]} + @door_logs.where("key = 'G'").group_by{|l| l.created_at.beginning_of_day}.each{|l| @door_log_graph << [l.first.to_time.to_i*1000,l.last.size]} respond_to do |format| format.html diff --git a/app/views/macs/show.html.erb b/app/views/macs/show.html.erb index bf1e1f1..0d9967c 100644 --- a/app/views/macs/show.html.erb +++ b/app/views/macs/show.html.erb @@ -23,5 +23,16 @@ <%= @mac.ip %>

+<% if can? :read, MacLog %> +

+ Recent Log Entries: +

+

+<% end %> + <%= link_to 'Edit', edit_mac_path(@mac) %> | <%= link_to 'Back', macs_path %> diff --git a/app/views/statistics/door_log.html.erb b/app/views/statistics/door_log.html.erb index 3680f7e..d15c2af 100644 --- a/app/views/statistics/door_log.html.erb +++ b/app/views/statistics/door_log.html.erb @@ -19,7 +19,7 @@ $(function() { }, yAxis : { title : { - text : "Hours" + text : "Accesses" } }, series: [{