Skip to content

Commit 271174d

Browse files
authored
[tools]fix CouchDB_Import_Instruments.php (#9755)
Fix script to get data from correct table now that it's been normalized out of the flag table.
1 parent 94d2232 commit 271174d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/CouchDB_Import_Instruments.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,16 @@ function generateDocumentSQL(string $tablename) : string
143143
JOIN session s ON(s.ID=f.SessionID)
144144
JOIN candidate c ON(c.ID=s.CandidateID)
145145
LEFT JOIN flag ddef ON(ddef.CommentID=CONCAT('DDE_', f.CommentID))
146-
LEFT JOIN test_names tn ON(f.TestID = tn.ID)";
146+
LEFT JOIN test_names tn ON(f.TestID = tn.ID)
147+
LEFT JOIN instrument_data d ON (d.ID = f.DataID) ";
147148

148149
$where = "WHERE f.CommentID NOT LIKE 'DDE%'
149150
AND tn.Test_name=:inst AND s.Active='Y' AND c.Active='Y'";
150151

151152
if ($tablename === "") {
152153
// the data is in the flag table, add the data column to the query
153154
// and do not join the table.
154-
$extraSelect = ", f.Data ";
155+
$extraSelect = ", d.Data ";
155156

156157
return $select . $extraSelect . $from . $where;
157158
}

0 commit comments

Comments
 (0)