Reversed order of door log, added date column
This commit is contained in:
parent
d73ea31625
commit
daa202131c
|
@ -5,7 +5,7 @@ class DoorLogsController < ApplicationController
|
||||||
# GET /door_logs
|
# GET /door_logs
|
||||||
# GET /door_logs.json
|
# GET /door_logs.json
|
||||||
def index
|
def index
|
||||||
@door_logs = DoorLog.all
|
@door_logs = DoorLog.find(:all, :order => "created_at DESC")
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
|
|
|
@ -7,6 +7,7 @@ class UsersController < ApplicationController
|
||||||
def index
|
def index
|
||||||
#@users = User.all
|
#@users = User.all
|
||||||
#authorize! :read, @users
|
#authorize! :read, @users
|
||||||
|
@users = @users.sort_by{|e| e[:card_id]}
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<%= link_to 'Download Door Logs', download_path %>
|
<%= link_to 'Download Door Logs', download_path %>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
<th>Key</th>
|
<th>Key</th>
|
||||||
<th>Data</th>
|
<th>Data</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
@ -10,28 +11,29 @@
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% @modulo_tmp = nil %>
|
<% @divided_tmp = nil %>
|
||||||
<% @door_logs.each do |door_log| %>
|
<% @door_logs.each do |door_log| %>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><%= door_log.created_at %></td>
|
||||||
<td><%= door_log.key %></td>
|
<td><%= door_log.key %></td>
|
||||||
<td><%= door_log.data %></td>
|
<td><%= door_log.data %></td>
|
||||||
<%
|
<%
|
||||||
if door_log.key == 'R' || door_log.key == 'D' ||door_log.key == 'G'
|
if door_log.key == 'r' || door_log.key == 'd' ||door_log.key == 'g'
|
||||||
@modulo_tmp = door_log.data.to_i
|
@divided_tmp = door_log.data.to_i
|
||||||
elsif (door_log.key == 'r' || door_log.key == 'd' || door_log.key == 'g') && !@modulo_tmp.nil? %>
|
elsif (door_log.key == 'R' || door_log.key == 'D' || door_log.key == 'G') && !@divided_tmp.nil? %>
|
||||||
<td>
|
<td>
|
||||||
<%= case door_log.key
|
<%= case door_log.key
|
||||||
when 'r'
|
when 'R'
|
||||||
"Read"
|
"Read"
|
||||||
when 'd'
|
when 'D'
|
||||||
"Denied"
|
"Denied"
|
||||||
when 'g'
|
when 'G'
|
||||||
"Granted"
|
"Granted"
|
||||||
end %>
|
end %>
|
||||||
<%= "Card: "+(@modulo_tmp+(door_log.data.to_i*32767)).to_s(16) %>
|
<%= "Card: "+(door_log.data.to_i+(@divided_tmp*32767)).to_s(16) %>
|
||||||
</td>
|
</td>
|
||||||
<% else
|
<% else
|
||||||
@modulo_tmp = nil
|
@divided_tmp = nil
|
||||||
end %>
|
end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user