Making door alert / webpage status work as expected
This commit is contained in:
parent
85ec806b22
commit
6334928779
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user