@watsonserve/stock-base 0.0.17 → 0.0.18
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/dao.js +2 -1
- package/package.json +1 -1
package/dao.js
CHANGED
|
@@ -97,8 +97,9 @@ export class InfluxDAO {
|
|
|
97
97
|
const ncQuery = ncs.map(nc => `r["nc"] == "${nc}"`).join(' or ');
|
|
98
98
|
const fdQuery = fileds.map(fd => `r["_field"] == "${fd}"`).join(' or ');
|
|
99
99
|
const filters = [mkQuery, ncQuery, fdQuery].filter(Boolean).map(str => `|> filter(fn: (r) => ${str})`).join('\n');
|
|
100
|
+
const start = new Date(lt.getTime() - 30 * A_DAY_MS).toJSON().substring(0, 10);
|
|
100
101
|
const fluxQuery = `from(bucket: "${bucket}")
|
|
101
|
-
|> range(start: ${
|
|
102
|
+
|> range(start: ${start}, stop: ${lt.toJSON()})
|
|
102
103
|
${filters}
|
|
103
104
|
|> last()
|
|
104
105
|
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")`;
|