From 8f4915eea9913887e1716ebf072e397d5b6a95e0 Mon Sep 17 00:00:00 2001 From: Laetitia Fesselier Date: Wed, 9 Sep 2020 15:53:12 -0400 Subject: [PATCH] [Help editor] Test plan update (#6970) Remove references to "Last Updated" in help editor test plan. Resolves #6959 --- test/run-php-linter.sh | 1 + tools/data_integrity/fix_candidate_age.php | 52 +++++++++++++++------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/test/run-php-linter.sh b/test/run-php-linter.sh index 5f0b7830ab7..31f2f6de569 100755 --- a/test/run-php-linter.sh +++ b/test/run-php-linter.sh @@ -51,6 +51,7 @@ declare -a tools_list=( 'CouchDB_Import_Demographics.php' 'CouchDB_Import_Instruments.php' 'CouchDB_MRI_Importer.php' + 'data_integrity/fix_candidate_age.php' ) # And on all PHP files in this array diff --git a/tools/data_integrity/fix_candidate_age.php b/tools/data_integrity/fix_candidate_age.php index 2f138214081..86c159236f5 100644 --- a/tools/data_integrity/fix_candidate_age.php +++ b/tools/data_integrity/fix_candidate_age.php @@ -35,9 +35,9 @@ $confirm = true; } -$incorrectAges = array(); -$nullAges = array(); -$verifiedTables = array(); +$incorrectAges = []; +$nullAges = []; +$verifiedTables = []; foreach ($instruments as $inst=>$fullName) { @@ -71,12 +71,16 @@ // Skip if Date taken does not exist if (!$DB->columnExists($inst, 'Date_taken')) { - echo "\t$inst does not use a `Date_taken` field and should be handled separately.\n"; + echo "\t" + . "$inst does not use a `Date_taken` field and should be handled separately." + . "\n"; continue; } // Skip if Date taken does not exist if (!$DB->columnExists($inst, 'Candidate_Age')) { - echo "\t$inst does not use a `Candidate_Age` field and should be handled separately.\n"; + echo "\t" + . "$inst does not use a `Candidate_Age` field " + . "and should be handled separately.\n"; continue; } @@ -88,13 +92,18 @@ LEFT JOIN session s ON (f.SessionID=s.ID) LEFT JOIN candidate c ON (s.CandID=c.CandID) WHERE c.Active='Y' AND s.Active='Y'", - array() + [] ); foreach ($DBInstTable as $k => $row) { // Get Instrument Instance with commentID try { - $instrument = NDB_BVL_Instrument::factory($inst, $row['CommentID'], '', false); + $instrument = NDB_BVL_Instrument::factory( + $inst, + $row['CommentID'], + '', + false + ); } catch (Exception $e) { echo "\t$inst instrument row with CommentID: ".$row['CommentID']." was ". " Ignored for one of the following reasons:\n". @@ -105,7 +114,9 @@ if (!$instrument) { // instrument does not exist - echo "\t$inst for CommentID:$row[CommentID] could not be instantiated.\n"; + echo "\t" + . "$inst for CommentID:$row[CommentID] could not be instantiated." + . "\n"; continue; } @@ -123,16 +134,18 @@ } else { // get Age from instrument class $calculatedAge = $instrument->getCandidateAge(); - $calculatedAgeMonths = $instrument->calculateAgeMonths($calculatedAge); + $calculatedAgeMonths = $instrument->calculateAgeMonths( + $calculatedAge + ); //Compare age to value saved in the instrument table $DBAge = $instrument->getFieldValue('Candidate_Age'); if ($calculatedAgeMonths != $DBAge) { //$incorrectAges[] = $row; - $incorrectAges[$inst][$commentID] = array( - 'cal' => $calculatedAgeMonths, - 'db' => $DBAge, - ); + $incorrectAges[$inst][$commentID] = [ + 'cal' => $calculatedAgeMonths, + 'db' => $DBAge, + ]; $trouble =true; } } @@ -140,7 +153,7 @@ //Fix the saved values if confirm and trouble flags enabled if ($trouble && $confirm) { echo "\tFixing age for CommentID: ".$commentID."\n"; - $instrument->_saveValues(array('Date_taken' => $dateTaken)); + $instrument->_saveValues(['Date_taken' => $dateTaken]); } } } @@ -162,11 +175,15 @@ } if (!$confirm) { - echo "\n\nRun this tool again with the argument 'confirm' to perform the changes\n\n"; + echo "\n\n" + . "Run this tool again with the argument 'confirm' to perform the changes" + . "\n\n"; } -/* +/** * Prints the usage and example help text and stop program + * + * @return void */ function showHelp() { @@ -179,7 +196,8 @@ function showHelp() echo "When the 'check' option is used, the script only detects and reports miscalculated and NULL ages. - Using the 'confirm' option will apply the necessary corrections to the data.\n\n"; + Using the 'confirm' option will apply the necessary corrections to the data." + . "\n\n"; die(); }