Listing door_logs

<%= link_to 'Download Door Logs', download_path %> Show Log Guide <% @divided_tmp = nil %> <% @door_logs.each do |door_log| %> <% if door_log.key == 'r' || door_log.key == 'd' ||door_log.key == 'g' @divided_tmp = door_log.data.to_i elsif (door_log.key == 'R' || door_log.key == 'D' || door_log.key == 'G') && !@divided_tmp.nil? %> <% else @divided_tmp = nil end %> <% end %>
Date Key Data
<%= door_log.created_at %> <%= door_log.key %> <%= door_log.data %> <%= case door_log.key when 'R' "Read" when 'D' "Denied" when 'G' "Granted" 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.user.name+")" unless @card.nil? %>