From 1f2ec9a940aaeb0009cadfa56a9ac2964caa88bb Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Fri, 9 Aug 2024 17:33:28 -0400 Subject: [PATCH] adding better comments --- src-electron/db/query-package.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src-electron/db/query-package.js b/src-electron/db/query-package.js index 35b40018aa..8bc28f8bb1 100644 --- a/src-electron/db/query-package.js +++ b/src-electron/db/query-package.js @@ -690,7 +690,17 @@ async function getAllPackages(db) { ) .then((rows) => rows.map(dbMapping.map.package)) } - +/** + * Retrieves attribute access interface options from the database. + * This function executes a query that combines results from the PACKAGE_OPTION and ATTRIBUTE tables, + * filtering by a specific code. It uses UNION to ensure no duplicate rows are returned, even if the same + * code exists in both tables. The results are then mapped to a standard format using dbMapping.map.options. + * + * @param {Object} db - The database connection object. + * @param {string} code - The code used to filter the results from both PACKAGE_OPTION and ATTRIBUTE tables. + * @returns {Promise} A promise that resolves to an array of objects, each representing an option + * with properties: PACKAGE_REF, OPTION_CATEGORY, OPTION_CODE, and OPTION_LABEL. + */ async function getAttributeAccessInterface(db, code) { const extendedQuery = ` SELECT