mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:37:07 +00:00
Merge branch '270-real-time-interface-stopped-working' into 'devel'
Resolve "Real-time interface stopped working" Closes #270 See merge request wgp/dougal/software!40
This commit is contained in:
@@ -8,14 +8,10 @@ let last_tstamp = 0;
|
||||
async function getAllProjectConfigs () {
|
||||
const client = await pool.connect();
|
||||
|
||||
const res0 = await client.query("SELECT schema FROM projects;");
|
||||
const text = res0.rows.map(r => {
|
||||
return `SELECT '${r.schema}' AS schema, data FROM ${r.schema}.file_data WHERE (data->>'archived')::boolean IS NOT true AND data->>'id' IS NOT NULL`;
|
||||
}).join("\nUNION ALL ");
|
||||
|
||||
const res1 = await client.query(text);
|
||||
const text = `SELECT schema, meta AS data FROM projects;`;
|
||||
const res = await client.query(text);
|
||||
client.release();
|
||||
return res1.rows.map(r => Object.assign(r.data, {schema: r.schema}));
|
||||
return res.rows;
|
||||
}
|
||||
|
||||
async function getNearestPreplot (candidates) {
|
||||
@@ -141,14 +137,14 @@ async function saveOnline (dataset, opts = {}) {
|
||||
await client.query(`
|
||||
INSERT INTO raw_shots
|
||||
(sequence, line, point, objref, tstamp, geometry, hash)
|
||||
VALUES ($1, $2, $3, $4, $5, ST_SetSRID(ST_MakePoint($6, $7), (SELECT (data->>'epsg')::integer AS epsg FROM file_data WHERE data ? 'id')), '*online*')
|
||||
VALUES ($1, $2, $3, $4, $5, ST_SetSRID(ST_MakePoint($6, $7), (select (project_configuration()->>'epsg')::integer as epsg)), '*online*')
|
||||
ON CONFLICT DO NOTHING;
|
||||
`, [item.sequence, item.line, item.point, 0, item.tstamp, item.easting, item.northing]);
|
||||
} else if (item.latitude && item.longitude) {
|
||||
await client.query(`
|
||||
INSERT INTO raw_shots
|
||||
(sequence, line, point, objref, tstamp, geometry, hash)
|
||||
VALUES ($1, $2, $3, $4, $5, ST_Transform(ST_SetSRID(ST_MakePoint($6, $7), 4326), (SELECT (data->>'epsg')::integer AS epsg FROM file_data WHERE data ? 'id')), '*online*')
|
||||
VALUES ($1, $2, $3, $4, $5, ST_Transform(ST_SetSRID(ST_MakePoint($6, $7), 4326), (select (project_configuration()->>'epsg')::integer as epsg)), '*online*')
|
||||
ON CONFLICT DO NOTHING;
|
||||
`, [item.sequence, item.line, item.point, 0, item.tstamp, item.longitude, item.latitude]);
|
||||
} else {
|
||||
@@ -186,7 +182,7 @@ async function saveOffline (navData, opts = {}) {
|
||||
} else if (schema && hasEastNorth) {
|
||||
const text = `
|
||||
INSERT INTO real_time_inputs (tstamp, geometry, meta)
|
||||
VALUES ($1, ST_Transform(ST_SetSRID(ST_MakePoint($2, $3), (SELECT (data->>'epsg')::integer AS epsg FROM ${schema}.file_data)), 4326), $4);
|
||||
VALUES ($1, ST_Transform(ST_SetSRID(ST_MakePoint($2, $3), (select (project_configuration()->>'epsg')::integer as epsg), 4326), $4);
|
||||
`;
|
||||
|
||||
const values = [navData.tstamp, navData.longitude, navData.latitude, navData.payload];
|
||||
|
||||
Reference in New Issue
Block a user