From d61289abafe226453809d1d836b692816c24c01a Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Fri, 4 Oct 2013 02:59:41 -0700 Subject: [PATCH] Adding analytics, adjusting door log issues --- app/controllers/cards_controller.rb | 2 +- app/views/door_logs/index.html.erb | 2 +- app/views/layouts/application.html.erb | 1 + app/views/settings/edit.html.erb | 1 + config/initializers/default_settings.rb | 3 ++- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/cards_controller.rb b/app/controllers/cards_controller.rb index 66c0759..8104783 100644 --- a/app/controllers/cards_controller.rb +++ b/app/controllers/cards_controller.rb @@ -34,7 +34,7 @@ class CardsController < ApplicationController def show if can? :read, DoorLog then card_num_R = @card.card_number.to_i(16)%32767 - @door_logs = DoorLog.where('key = ? AND data = ?', "R", card_num_R).order("created_at DESC") + @door_logs = DoorLog.where('key = ? AND data = ?', "G", card_num_R).order("created_at DESC") end respond_to do |format| format.html # show.html.erb diff --git a/app/views/door_logs/index.html.erb b/app/views/door_logs/index.html.erb index 7366721..e286c70 100644 --- a/app/views/door_logs/index.html.erb +++ b/app/views/door_logs/index.html.erb @@ -72,7 +72,7 @@ Guide to log keys and data: end %> <% @cardnum = (door_log.data.to_i+(@divided_tmp*32767)).to_s(16) %> <%= "Card: "+@cardnum %> - <% @card = Card.find(:first,:conditions=>['card_number LIKE ?', @cardnum]) %> + <% @card = Card.find(:first,:conditions=>['lower(card_number) = ?', @cardnum.downcase]) %> <%= "("+@card.user.name+")" unless @card.nil? %> <% else diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 828e8f1..7718e44 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -30,5 +30,6 @@

<%= raw(alert) %>

<%= yield %> +<%= raw Setting.analytics_code if Setting.present? %> diff --git a/app/views/settings/edit.html.erb b/app/views/settings/edit.html.erb index c5f6a7d..b88b213 100644 --- a/app/views/settings/edit.html.erb +++ b/app/views/settings/edit.html.erb @@ -1,3 +1,4 @@ +