Skip to content

Commit

Permalink
fix truth table
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDTR committed Oct 19, 2024
1 parent 3ff6971 commit 80b1655
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/DoorStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ const DoorStatus = () => {
const backDoor = data.find((door) => door.door === "back");
const frontDoor = data.find((door) => door.door === "front");

if (backDoor?.status === "on" && frontDoor?.status === "on") {
setIsOpen(true);
} else if (backDoor?.status === "off" && frontDoor?.status === "off") {
if (backDoor?.status === "off" || frontDoor?.status === "off") {
setIsOpen(false);
} else {
setIsOpen(null);
} else if (backDoor?.status === "on" && frontDoor?.status === "on") {
setIsOpen(true);
}
} catch (error) {
console.error("Error fetching door status:", error);
Expand Down Expand Up @@ -78,4 +76,4 @@ const DoorStatus = () => {
);
};

export default DoorStatus;
export default DoorStatus;

0 comments on commit 80b1655

Please sign in to comment.