fix: corretto funzionamento dei filtri per gli stati aperti dei ticket (ignora lo stato dei ticket)
This commit is contained in:
+25
-15
@@ -90,17 +90,18 @@ db.exec(`
|
||||
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS dashboard_chart_lines (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
statuses TEXT NOT NULL,
|
||||
types TEXT NOT NULL,
|
||||
queues TEXT NOT NULL,
|
||||
owners TEXT NOT NULL,
|
||||
responsibles TEXT NOT NULL,
|
||||
color TEXT,
|
||||
is_visible INTEGER NOT NULL DEFAULT 1,
|
||||
is_default INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
statuses TEXT NOT NULL,
|
||||
types TEXT NOT NULL,
|
||||
queues TEXT NOT NULL,
|
||||
owners TEXT NOT NULL,
|
||||
responsibles TEXT NOT NULL,
|
||||
color TEXT,
|
||||
is_visible INTEGER NOT NULL DEFAULT 1,
|
||||
is_default INTEGER NOT NULL DEFAULT 0,
|
||||
bypass_state_filter INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
||||
)
|
||||
`);
|
||||
|
||||
@@ -116,22 +117,31 @@ try {
|
||||
// Already exists
|
||||
}
|
||||
|
||||
try {
|
||||
db.exec(`ALTER TABLE dashboard_chart_lines ADD COLUMN bypass_state_filter INTEGER NOT NULL DEFAULT 0`);
|
||||
} catch (e) {
|
||||
// Already exists
|
||||
}
|
||||
|
||||
try {
|
||||
const countRow = db.prepare("SELECT COUNT(*) AS count FROM dashboard_chart_lines").get();
|
||||
if (countRow && countRow.count === 0) {
|
||||
db.prepare(`
|
||||
INSERT INTO dashboard_chart_lines (name, statuses, types, queues, owners, responsibles, color, is_visible, is_default)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, 1, 1)
|
||||
INSERT INTO dashboard_chart_lines (name, statuses, types, queues, owners, responsibles, color, is_visible, is_default, bypass_state_filter)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, 1, 1, 1)
|
||||
`).run('Ticket aperti', JSON.stringify([1, 4, 6, 7, 8]), '[]', '[]', '[]', '[]', '#4f46e5');
|
||||
|
||||
db.prepare(`
|
||||
INSERT INTO dashboard_chart_lines (name, statuses, types, queues, owners, responsibles, color, is_visible, is_default)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, 1, 1)
|
||||
INSERT INTO dashboard_chart_lines (name, statuses, types, queues, owners, responsibles, color, is_visible, is_default, bypass_state_filter)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, 1, 1, 0)
|
||||
`).run('Ticket chiusi', JSON.stringify([2, 3, 10]), '[]', '[]', '[]', '[]', '#10b981');
|
||||
} else {
|
||||
// Update default ones color if not set yet
|
||||
db.prepare(`UPDATE dashboard_chart_lines SET color = '#4f46e5' WHERE name = 'Ticket aperti' AND color IS NULL`).run();
|
||||
db.prepare(`UPDATE dashboard_chart_lines SET color = '#10b981' WHERE name = 'Ticket chiusi' AND color IS NULL`).run();
|
||||
|
||||
// Set default Ticket aperti to bypass state filter
|
||||
db.prepare(`UPDATE dashboard_chart_lines SET bypass_state_filter = 1 WHERE name = 'Ticket aperti'`).run();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error seeding default chart lines:", e.message);
|
||||
|
||||
Reference in New Issue
Block a user