From 0eeaddabd740f8feb343637fae67b495babfcf07 Mon Sep 17 00:00:00 2001
From: Will Bradley
Date: Wed, 2 Oct 2013 04:57:46 -0700
Subject: [PATCH] Adjusting wording and stat counts
---
app/controllers/macs_controller.rb | 1 +
app/controllers/statistics_controller.rb | 2 +-
app/views/macs/show.html.erb | 11 +++++++++++
app/views/statistics/door_log.html.erb | 2 +-
4 files changed, 14 insertions(+), 2 deletions(-)
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:
+
+<% @mac_logs.each do |log| %>
+ - <%= log.created_at %>
+<% end %>
+
+
+<% 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: [{