Making door alert / webpage status work as expected

This commit is contained in:
Will Bradley 2014-10-07 19:55:34 -07:00
parent 85ec806b22
commit 6334928779
2 changed files with 3 additions and 3 deletions

View File

@ -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.find(:all, :order => "created_at DESC", :limit => 100) @door_logs = DoorLog.find(:all, :order => "created_at DESC", :limit => 1000)
begin begin

View File

@ -91,8 +91,8 @@ class DoorLog < ActiveRecord::Base
door_1_locked = parse_locked_status(door_logs, "door_1_locked") door_1_locked = parse_locked_status(door_logs, "door_1_locked")
door_2_locked = parse_locked_status(door_logs, "door_2_locked") door_2_locked = parse_locked_status(door_logs, "door_2_locked")
# Doors are unlocked if 1 AND 2 are NOT locked # Doors are unlocked if 1 OR 2 are NOT locked
status = {:unlocked => (!door_1_locked && !door_2_locked), :door_1_locked => door_1_locked, :door_2_locked => door_2_locked } status = {:unlocked => (!door_1_locked || !door_2_locked), :door_1_locked => door_1_locked, :door_2_locked => door_2_locked }
end end
def self.parse_locked_status(door_logs, door_key) def self.parse_locked_status(door_logs, door_key)