mirror of
https://github.com/DeNNiiInc/Web-Page-Performance-Test.git
synced 2026-04-17 20:05:58 +00:00
Fix database insert - add user_ip column
This commit is contained in:
@@ -243,24 +243,21 @@ async function _executeTest(url, options) {
|
|||||||
// Prepare Database Insert
|
// Prepare Database Insert
|
||||||
const insertQuery = `
|
const insertQuery = `
|
||||||
INSERT INTO test_results (
|
INSERT INTO test_results (
|
||||||
id, url, user_uuid, is_mobile,
|
id, url, user_uuid, user_ip, is_mobile,
|
||||||
scores, metrics, filmstrip, timestamp
|
scores, metrics, filmstrip, timestamp
|
||||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, NOW())
|
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, NOW())
|
||||||
RETURNING id
|
RETURNING id
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Convert objects to JSON strings for DB text columns if needed,
|
|
||||||
// or rely on pg to stringify objects for JSONB columns if schema uses JSONB.
|
|
||||||
// Based on previous errors, schema might be expecting JSON.
|
|
||||||
|
|
||||||
const values = [
|
const values = [
|
||||||
testId,
|
testId,
|
||||||
lhr.finalUrl,
|
lhr.finalUrl,
|
||||||
options.userUuid || null, // Ensure options is available or pass it in
|
options.userUuid || null,
|
||||||
|
options.userIp || null,
|
||||||
isMobile,
|
isMobile,
|
||||||
JSON.stringify(summary.scores),
|
summary.scores,
|
||||||
JSON.stringify(summary.metrics),
|
summary.metrics,
|
||||||
JSON.stringify(filmstripData)
|
filmstripData
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user