Update Value Report.
This commit is contained in:
@@ -57,7 +57,7 @@ class HistoryValueController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getHistoryValueReportPivot(req, res) {
|
static async getHistoryValueReportPivot(req, res) {
|
||||||
try {
|
try {
|
||||||
const queryParams = req.query;
|
const queryParams = req.query;
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ static async getHistoryValueReportPivot(req, res) {
|
|||||||
message: error.message || 'Internal server error'
|
message: error.message || 'Internal server error'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getHistoryValueTrendingPivot(req, res) {
|
static async getHistoryValueTrendingPivot(req, res) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -385,10 +385,7 @@ const getHistoryValueReportPivotDb = async (tableName, searchParams = {}) => {
|
|||||||
OPTION (MAXRECURSION 0);
|
OPTION (MAXRECURSION 0);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const request = pool.request();
|
const result = await pool.query(queryText, [from, to, interval]);
|
||||||
request.timeout = 60000; // 60 detik
|
|
||||||
|
|
||||||
const result = await request.query(queryText, [from, to, interval]);
|
|
||||||
|
|
||||||
if (result.recordsets && result.recordsets.length >= 2) {
|
if (result.recordsets && result.recordsets.length >= 2) {
|
||||||
console.log('Sample averaging data:');
|
console.log('Sample averaging data:');
|
||||||
@@ -551,7 +548,7 @@ const getHistoryValueTrendingPivotDb = async (tableName, searchParams = {}) => {
|
|||||||
const tagList = Object.keys(rows[0]).filter(k => k !== timeKey);
|
const tagList = Object.keys(rows[0]).filter(k => k !== timeKey);
|
||||||
|
|
||||||
const nivoData = tagList.map(tag => ({
|
const nivoData = tagList.map(tag => ({
|
||||||
name: tag,
|
id: tag,
|
||||||
data: rows.map(row => ({
|
data: rows.map(row => ({
|
||||||
x: row[timeKey],
|
x: row[timeKey],
|
||||||
y: row[tag] !== null ? Number(row[tag]) : null
|
y: row[tag] !== null ? Number(row[tag]) : null
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class HistoryValue {
|
|||||||
error.message || 'Error fetching history value report pivot'
|
error.message || 'Error fetching history value report pivot'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getHistoryValueTrendingPivot(param) {
|
static async getHistoryValueTrendingPivot(param) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user