Update Value Report.

This commit is contained in:
Athif
2025-12-18 13:37:47 +07:00
parent c112ff165a
commit 1496b80fdf
3 changed files with 52 additions and 55 deletions

View File

@@ -57,7 +57,7 @@ class HistoryValueController {
}
}
static async getHistoryValueReportPivot(req, res) {
static async getHistoryValueReportPivot(req, res) {
try {
const queryParams = req.query;
@@ -77,7 +77,7 @@ static async getHistoryValueReportPivot(req, res) {
message: error.message || 'Internal server error'
});
}
}
}
static async getHistoryValueTrendingPivot(req, res) {
try {

View File

@@ -385,10 +385,7 @@ const getHistoryValueReportPivotDb = async (tableName, searchParams = {}) => {
OPTION (MAXRECURSION 0);
`;
const request = pool.request();
request.timeout = 60000; // 60 detik
const result = await request.query(queryText, [from, to, interval]);
const result = await pool.query(queryText, [from, to, interval]);
if (result.recordsets && result.recordsets.length >= 2) {
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 nivoData = tagList.map(tag => ({
name: tag,
id: tag,
data: rows.map(row => ({
x: row[timeKey],
y: row[tag] !== null ? Number(row[tag]) : null

View File

@@ -98,7 +98,7 @@ class HistoryValue {
error.message || 'Error fetching history value report pivot'
);
}
}
}
static async getHistoryValueTrendingPivot(param) {
try {