Skip to content

Commit

Permalink
Filter the query with parameter_type_category.Type = instrument
Browse files Browse the repository at this point in the history
  • Loading branch information
laemtl committed Apr 19, 2024
1 parent 812ec37 commit 40a51a6
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tools/exporters/data_dictionary_builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@
$instrumentParameterTypeIDs = [];

$parameter_types = $DB->pselectColWithIndexKey(
"SELECT
CONCAT(`Name`, '-', `SourceFrom`) AS paramkey,
ParameterTypeID
FROM parameter_type",
"SELECT pt.Name, pt.ParameterTypeID
FROM parameter_type pt
JOIN parameter_type_category_rel ptcr USING (ParameterTypeID)
JOIN parameter_type_category ptc USING (ParameterTypeCategoryID)
WHERE ptc.Type = 'Instrument'",
[],
"paramkey"
"Name"
);

// 2 query to clear all old parameter_type data associated to instruments.
Expand Down Expand Up @@ -207,12 +208,11 @@
"Queryable" => "1",
];

$key = "$Name-$testname";
// Check if the same element existed in the parameter_type table
// before deleting the data.
if (array_key_exists($key, $parameter_types)) {
if (array_key_exists($Name, $parameter_types)) {
//If element existed, reuse the same id
$ParameterTypeID = $parameter_types[$key];
$ParameterTypeID = $parameter_types[$Name];
$query_params["ParameterTypeID"] = $ParameterTypeID;
} else {
//If it's new set it to empty string
Expand Down Expand Up @@ -268,9 +268,8 @@
"Queryable" => "1",
];

$key = "$Name-$testname";
if (array_key_exists($key, $parameter_types)) {
$ParameterTypeID = $parameter_types[$key];
if (array_key_exists($Name, $parameter_types)) {
$ParameterTypeID = $parameter_types[$Name];
$query_params["ParameterTypeID"] = $ParameterTypeID;
} else {
$ParameterTypeID = "";
Expand Down Expand Up @@ -313,9 +312,8 @@
"Queryable" => "1",
];

$key = "$Name-$testname";
if (array_key_exists($key, $parameter_types)) {
$ParameterTypeID = $parameter_types[$key];
if (array_key_exists($Name, $parameter_types)) {
$ParameterTypeID = $parameter_types[$Name];
$query_params["ParameterTypeID"] = $ParameterTypeID;
} else {
$ParameterTypeID = "";
Expand Down

0 comments on commit 40a51a6

Please # to comment.