43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/**
|
|
* Quick check for single-digit hour times
|
|
*/
|
|
|
|
import { rawQuery } from '../src/db.js';
|
|
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
async function check() {
|
|
const total = await rawQuery(`
|
|
SELECT COUNT(*) as total
|
|
FROM "OptionsFlow_monthly"
|
|
WHERE "CreatedTime" IS NOT NULL
|
|
AND (
|
|
"CreatedTime"::text ~ '^[1-9]:[0-9]{2}:[0-9]{2}\\s*(AM|PM)$'
|
|
OR "CreatedTime"::text ~ '^[1-9]:[0-9]{2}\\s*(AM|PM)$'
|
|
);
|
|
`);
|
|
|
|
console.log('Total entries with single-digit hours:', total[0]?.total || 0);
|
|
|
|
const dateCheck = await rawQuery(`
|
|
SELECT "CreatedDate", "CreatedTime", COUNT(*) as cnt
|
|
FROM "OptionsFlow_monthly"
|
|
WHERE "CreatedDate" = '2025-12-17'
|
|
AND "CreatedTime" IS NOT NULL
|
|
AND (
|
|
"CreatedTime"::text ~ '^[1-9]:[0-9]{2}:[0-9]{2}\\s*(AM|PM)$'
|
|
OR "CreatedTime"::text ~ '^[1-9]:[0-9]{2}\\s*(AM|PM)$'
|
|
)
|
|
GROUP BY "CreatedDate", "CreatedTime"
|
|
ORDER BY cnt DESC
|
|
LIMIT 10;
|
|
`);
|
|
|
|
console.log('\nEntries on 2025-12-17 with single-digit hours:');
|
|
dateCheck.forEach(r => console.log(` ${r.CreatedTime}: ${r.cnt} occurrences`));
|
|
}
|
|
|
|
check().then(() => process.exit(0)).catch(e => { console.error(e); process.exit(1); });
|
|
|