@yarkivaev/scada 2.6.26 → 2.6.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarkivaev/scada",
3
- "version": "2.6.26",
3
+ "version": "2.6.27",
4
4
  "description": "SCADA domain objects, state persistence, and plant monitoring",
5
5
  "repository": {
6
6
  "type": "git",
@@ -147,7 +147,7 @@ async function removeObsolete(client, record) {
147
147
  await client.query(
148
148
  `DELETE FROM segments
149
149
  WHERE machine = $1 AND kind = 'phase'
150
- AND (start_time = $2 OR (properties IS NOT NULL AND properties::jsonb ->> 'split_of' = $3))
150
+ AND (start_time = $2 OR (CASE WHEN left(btrim(COALESCE(properties, '')), 1) = '{' THEN properties::jsonb ->> 'split_of' END) = $3)
151
151
  AND NOT (start_time = ANY($4::timestamptz[]))`,
152
152
  [record.machine, origin, String(record.origin), starts]
153
153
  );
@@ -168,7 +168,7 @@ export async function loadFamily(pool, machine, start) {
168
168
  `SELECT name, start_time, end_time, duration, properties
169
169
  FROM segments
170
170
  WHERE machine = $1 AND kind = 'phase'
171
- AND (start_time = $2 OR (properties IS NOT NULL AND properties::jsonb ->> 'split_of' = $3))
171
+ AND (start_time = $2 OR (CASE WHEN left(btrim(COALESCE(properties, '')), 1) = '{' THEN properties::jsonb ->> 'split_of' END) = $3)
172
172
  ORDER BY start_time`,
173
173
  [machine, start, String(start.getTime())]
174
174
  );