@ejfdelgado/ejflab-common 1.13.3 → 1.14.0
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
package/src/MyDates.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const offset = new Date().getTimezoneOffset() / 60;
|
|
2
2
|
|
|
3
|
+
// https://www.npmjs.com/package/dateformat
|
|
4
|
+
|
|
3
5
|
class MyDates {
|
|
4
6
|
static getSelectedLanguage() {
|
|
5
7
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -138,16 +140,15 @@ class MyDates {
|
|
|
138
140
|
}
|
|
139
141
|
// MyDates.getDefaults(args)
|
|
140
142
|
static getDefaults(args, currentYear, nextYears, myDefault = "") {
|
|
141
|
-
console.log(JSON.stringify(args, null, 4));
|
|
142
143
|
if (args instanceof Array) {
|
|
143
|
-
if (args.
|
|
144
|
+
if (args.length == 1) {
|
|
144
145
|
currentYear = args[0];
|
|
145
146
|
nextYears = args[0];
|
|
146
|
-
} else if (args.
|
|
147
|
+
} else if (args.length == 2) {
|
|
147
148
|
currentYear = args[0];
|
|
148
149
|
nextYears = args[1];
|
|
149
150
|
}
|
|
150
|
-
if (args.
|
|
151
|
+
if (args.length >= 3) {
|
|
151
152
|
myDefault = args[2];
|
|
152
153
|
}
|
|
153
154
|
}
|
|
@@ -10,7 +10,8 @@ class CommandPostgres extends CommandBasic {
|
|
|
10
10
|
const script = this.args[3];
|
|
11
11
|
const destination = this.args[4];
|
|
12
12
|
const postgresSrv = this.context.getSuperContext().getPostgresClient();
|
|
13
|
-
|
|
13
|
+
const paging = action == "page";
|
|
14
|
+
if (["execute", "page"].indexOf(action) >= 0) {
|
|
14
15
|
//console.log("Starting execute...");
|
|
15
16
|
const dbIdData = SimpleObj.getValue(this.context.data, dbIdPath, null);
|
|
16
17
|
let bodyData = {};
|
|
@@ -35,7 +36,21 @@ class CommandPostgres extends CommandBasic {
|
|
|
35
36
|
const payload = JSON.parse(JSON.stringify(dbIdData));
|
|
36
37
|
payload.object = bodyData[i];
|
|
37
38
|
payload.now = now;
|
|
38
|
-
const result =
|
|
39
|
+
const result = { rows: [], rowCount: 0, command: null };
|
|
40
|
+
let localResult = { rows: [], rowCount: 0, command: null };
|
|
41
|
+
if (paging) {
|
|
42
|
+
if (typeof payload.limit !== "number") {
|
|
43
|
+
payload.limit = 20;
|
|
44
|
+
}
|
|
45
|
+
payload.offset = 0;
|
|
46
|
+
}
|
|
47
|
+
do {
|
|
48
|
+
localResult = await postgresSrv.executeFile(script, payload, client);
|
|
49
|
+
result.rows.push(...localResult.rows);
|
|
50
|
+
result.rowCount += localResult.rowCount;
|
|
51
|
+
result.command = localResult.command;
|
|
52
|
+
payload.offset += result.rows.length;
|
|
53
|
+
} while (paging && localResult.rows.length > 0);
|
|
39
54
|
response.push(result);
|
|
40
55
|
}
|
|
41
56
|
await client.query("COMMIT");
|