/** * Verify that time fixes were applied correctly */ import { rawQuery } from '../src/db.js'; import dotenv from 'dotenv'; dotenv.config(); async function verify() { console.log('šŸ” Verifying time fixes...\n'); // Check for any remaining single-digit hours const remaining = 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)$' ); `); const remainingCount = remaining[0]?.total || 0; console.log(`Single-digit hour entries remaining: ${remainingCount}`); if (remainingCount > 0) { console.log('āš ļø Some entries still need fixing'); } else { console.log('āœ… All single-digit hours have been fixed!'); } // Check specific times from error message const specificCheck = await rawQuery(` SELECT "CreatedTime", COUNT(*) as cnt FROM "OptionsFlow_monthly" WHERE "CreatedDate" = '2025-12-17' AND ( "CreatedTime" LIKE '%2:30%' OR "CreatedTime" LIKE '%2:31%' ) GROUP BY "CreatedTime" ORDER BY cnt DESC; `); console.log('\nTimes matching 2:30 or 2:31 on 2025-12-17:'); if (specificCheck.length === 0) { console.log(' āœ… None found - all fixed!'); } else { specificCheck.forEach(r => console.log(` ${r.CreatedTime}: ${r.cnt} occurrences`)); } // Show sample of properly formatted times const sample = await rawQuery(` SELECT "CreatedTime", COUNT(*) as cnt FROM "OptionsFlow_monthly" WHERE "CreatedDate" = '2025-12-17' AND "CreatedTime" IS NOT NULL AND "CreatedTime"::text ~ '^[0-9]{2}:[0-9]{2}:[0-9]{2}\\s*(AM|PM)$' GROUP BY "CreatedTime" ORDER BY cnt DESC LIMIT 10; `); console.log('\nāœ… Sample of properly formatted times on 2025-12-17:'); sample.forEach(r => console.log(` ${r.CreatedTime}: ${r.cnt} occurrences`)); } verify().then(() => process.exit(0)).catch(e => { console.error(e); process.exit(1); });