Skip to content

Commit

Permalink
fix code slot bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ethayer committed Jul 21, 2015
1 parent 679529e commit f7a13fc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions user-lock-manager.smartapp.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* User Lock Manager v3.8.0
* User Lock Manager v3.8.1
*
* Copyright 2015 Erik Thayer
*
Expand Down Expand Up @@ -963,28 +963,29 @@ def pollCodeReport(evt) {

def array = []
(1..maxUsers).each { user->
def code = codeData."code${user}"
def usedSlot = usedUserSlot(user)
def slot = settings."userSlot${user}"
def code = codeData."code${slot}"
def correctCode = settings."userCode${user}"
if (active) {
if (userIsEnabled(usedSlot) && isActiveBurnCode(usedSlot)) {
if (code == settings."userCode${usedSlot}") {
if (userIsEnabled(user) && isActiveBurnCode(user)) {
if (code == settings."userCode${user}") {
// Code is Active, We should be active. Nothing to do
} else {
// Code is incorrect, We should be active.
array << ["code${user}", settings."userCode${usedSlot}"]
array << ["code${slot}", settings."userCode${user}"]
}
} else {
if (code != '') {
// Code is set, user is disabled, We should be disabled.
array << ["code${user}", ""]
array << ["code${slot}", ""]
} else {
// Code is not set, user is disabled. Nothing to do
}
}
} else {
if (code != '') {
// Code is set, We should be disabled.
array << ["code${user}", ""]
array << ["code${slot}", ""]
} else {
// Code is not active, We should be disabled. Nothing to do
}
Expand Down

1 comment on commit f7a13fc

@bgadam
Copy link

@bgadam bgadam commented on f7a13fc Jul 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this fix!

Please sign in to comment.