IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Unverified Commit 0bfe343a authored by Anthony Palumbo's avatar Anthony Palumbo Committed by GitHub
Browse files

Adding is_private check and locations to Export LWCs. (#89)

parent 99138493
......@@ -46,7 +46,14 @@ const findAssetTypes = async () => {
*/
const findAssetPropTypes = async (assetTypeID) => {
let query = PROPERTIES_QUERY;
query = query + ' WHERE asset_type_id=$1 ORDER BY id';
query = query + `
WHERE
asset_type_id = $1
AND
is_private = false
ORDER BY
id
`;
const params = [assetTypeID];
......@@ -60,16 +67,20 @@ const findAssetPropTypes = async (assetTypeID) => {
const findAssetPropsByTypeID = async (assetTypeID) => {
let query = `
SELECT
asset.id as id, asset_property.value as value, asset_property.property_id as property_id
asset.id AS id,
ST_X(asset.location) AS longitude,
ST_Y(asset.location) AS latitude,
asset_property.value AS value,
asset_property.property_id AS property_id,
property.is_private AS is_private
FROM
asset
INNER JOIN
asset_property
ON
asset_property.asset_id=asset.id
asset
JOIN asset_property ON asset_property.asset_id = asset.id
JOIN property ON asset_property.property_id = property.id
WHERE
asset_type_id = $1
asset.asset_type_id = $1
AND
property.is_private = false
ORDER BY
property_id
`;
......
......@@ -52,7 +52,7 @@ export default class ExportCSV extends LightningElement {
assetDefinitions.fetchAssetPropTypes(this.valueID)
.then(properties => {
// [asset_type_id],[asset_type_name]
rows = ['asset_type_id', this.value.split(':')[0].trimRight()];
rows = ['asset_type_id', 'asset_id', 'longitude', 'latitude'];
for (i = 0; i < properties.rows.length; i++) {
rows.push(properties.rows[i]['name']);
}
......@@ -72,6 +72,8 @@ export default class ExportCSV extends LightningElement {
rows = [];
rows.push(this.valueID);
rows.push(keys[i]);
rows.push(data.rows[i]['longitude']);
rows.push(data.rows[i]['latitude']);
for (j = 0; j < props[keys[i]].length; j++) {
rows.push(props[keys[i]][j]);
}
......
......@@ -49,7 +49,7 @@ export default class ExportHeaders extends LightningElement {
assetDefinitions.fetchAssetPropTypes(this.valueID)
.then(properties => {
rows = ['asset_id'];
rows = ['asset_id', 'longitude', 'latitude'];
for (i = 0; i < properties.rows.length; i++) {
rows.push(properties.rows[i]['name']);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment