diff --git a/app/views/door_logs/index.html.erb b/app/views/door_logs/index.html.erb index fcbfa07..a8d5ae7 100644 --- a/app/views/door_logs/index.html.erb +++ b/app/views/door_logs/index.html.erb @@ -10,10 +10,29 @@ +<% @modulo_tmp = nil %> <% @door_logs.each do |door_log| %> <%= door_log.key %> <%= door_log.data %> + <% + if door_log.key == 'R' || door_log.key == 'D' ||door_log.key == 'G' + @modulo_tmp = door_log.data.to_i + elsif (door_log.key == 'r' || door_log.key == 'd' || door_log.key == 'g') && !@modulo_tmp.nil? %> + + <%= case door_log.key + when 'r' + "Read" + when 'd' + "Denied" + when 'g' + "Granted" + end %> + <%= "Card: "+(@modulo_tmp+(door_log.data.to_i*32767)).to_s(16) %> + + <% else + @modulo_tmp = nil + end %> <% end %>