Skip to content

Commit

Permalink
[Help editor] Test plan update (aces#6970)
Browse files Browse the repository at this point in the history
Remove references to "Last Updated" in help editor test plan.

    Resolves aces#6959
  • Loading branch information
laemtl committed Sep 10, 2020
1 parent 12e384a commit 8f4915e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
1 change: 1 addition & 0 deletions test/run-php-linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 35 additions & 17 deletions tools/data_integrity/fix_candidate_age.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
$confirm = true;
}

$incorrectAges = array();
$nullAges = array();
$verifiedTables = array();
$incorrectAges = [];
$nullAges = [];
$verifiedTables = [];

foreach ($instruments as $inst=>$fullName) {

Expand Down Expand Up @@ -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;
}

Expand All @@ -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".
Expand All @@ -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;
}

Expand All @@ -123,24 +134,26 @@
} 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;
}
}

//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]);
}
}
}
Expand All @@ -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()
{
Expand All @@ -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();
}

0 comments on commit 8f4915e

Please sign in to comment.