@golemio/pid 2.18.1-dev.1427397189 → 2.18.1-dev.1428609955

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.
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20240827075829-remove-analytic-departure-boards-view-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20240827075829-remove-analytic-departure-boards-view-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,30 @@
1
+ CREATE VIEW analytic.v_ropid_departure_boards
2
+ AS SELECT final.lon,
3
+ final.lat,
4
+ final.route_name,
5
+ final.note,
6
+ final.stop_correct,
7
+ count(1) OVER (PARTITION BY (split_part(final.stop_correct, '/'::text, 1))) AS n_ceduli,
8
+ final.alt_idos_name
9
+ FROM ( SELECT stops.lon,
10
+ stops.lat,
11
+ tab.route_name,
12
+ tab.note,
13
+ tab.stop_correct,
14
+ stops.alt_idos_name,
15
+ row_number() OVER (PARTITION BY tab.note) AS n_duplicit
16
+ FROM ( SELECT rdp.route_name,
17
+ rdp.note,
18
+ CASE
19
+ WHEN rdp.url_query_params::text ~~ '%aswIds%'::text THEN replace("substring"(rdp.url_query_params::text, 'aswIds[^=]*?=(.+?(?=&|$))'::text), '_'::text, '/'::text)
20
+ WHEN rdp.url_query_params::text ~~ '%cisIds%'::text THEN "substring"(rdp.url_query_params::text, 'cisIds[^=]*?=(.+?(?=&|$))'::text)
21
+ ELSE NULL::text
22
+ END AS stop_correct
23
+ FROM ropid_departures_presets rdp) tab
24
+ LEFT JOIN ropidgtfs_cis_stops stops ON
25
+ CASE
26
+ WHEN tab.stop_correct ~~ '%/%'::text THEN tab.stop_correct = stops.id::text
27
+ ELSE tab.stop_correct = split_part(stops.id::text, '/'::text, 1)
28
+ END OR tab.stop_correct = stops.cis::text) final
29
+ WHERE final.n_duplicit = 1
30
+ ORDER BY final.stop_correct;
@@ -0,0 +1 @@
1
+ drop view analytic.v_ropid_departure_boards;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.18.1-dev.1427397189",
3
+ "version": "2.18.1-dev.1428609955",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",