-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tools] CouchDB Importer Integrity not removing inactive candidates #2801
[tools] CouchDB Importer Integrity not removing inactive candidates #2801
Conversation
gluneau
commented
May 12, 2017
- Delete documents if candidate is inactive
- Checking if sql result array is not empty before deleting
tools/CouchDB_Confirm_Integrity.php
Outdated
@@ -80,31 +81,40 @@ function run() | |||
"VL" => $vl | |||
) | |||
); | |||
$inactiveCandID = $this->SQLDB->pselectRow("SELECT * FROM candidate c WHERE c.Active='N' AND c.PSCID=:PID", array("PID" => $pscid)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this extra query is required over just adding Active='Y'
(for both the session and candidate) to the query above just above it (that isn't showing up in the diff.)
18c95e4
to
b9a635b
Compare
@jstirling91 Please review and test as suggested by @driusan, Thank you. |
if ($numActive[0]['count'] == '0') { | ||
print "PSCID $pscid VL $vl is cancelled and has no active" | ||
|
||
if (!array_key_exists('count', $numActive[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gluneau why do we need this !array_key_exists()
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid printing stuff to the log. just answered myself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jstirling91 you should definitely re-review. LGTM
@jstirling91 Let me know when you can review and test. |
@driusan @jstirling91 Can we get this tested? |
@driusan @jstirling91 Please test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good (pending it being tested..)
tools/CouchDB_Confirm_Integrity.php
Outdated
$this->CouchDB->deleteDoc($row['id']); | ||
} | ||
|
||
if (!empty($sqlDB) && $sqlDB['Active'] != 'Y') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an 'else if' statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that going to affect the functionality or just make it cleaner?
(I'm not sure what happens in our code if you try and delete an already deleted CouchDB doc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to handle the case of the last 'else' statement. Currently it'll still print "Nothing wrong with $row[id]!\n"
even if it hit the first if
case above.
tools/CouchDB_Confirm_Integrity.php
Outdated
$this->CouchDB->deleteDoc($row['id']); | ||
} | ||
|
||
if (!empty($sqlDB) && $sqlDB['Active'] != 'Y') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to handle the case of the last 'else' statement. Currently it'll still print "Nothing wrong with $row[id]!\n"
even if it hit the first if
case above.
Okay this github review system can be confusing |
…eau/Loris into integrityNotRemoveingInactiveCandID
@Jkat Please take a look at the change |