Files
cannaiq/backend/check-enrichment-progress.ts
2025-11-28 19:45:44 -07:00

26 lines
704 B
TypeScript

import { pool } from './src/db/migrate.js';
async function main() {
const result = await pool.query(`
SELECT
COUNT(*) as total,
COUNT(regular_price) as with_prices,
COUNT(*) - COUNT(regular_price) as without_prices
FROM products
WHERE dispensary_id = 112
`);
const stats = result.rows[0];
const pct = ((parseInt(stats.with_prices) / parseInt(stats.total)) * 100).toFixed(1);
console.log('\nENRICHMENT PROGRESS:');
console.log(` Total products: ${stats.total}`);
console.log(` With prices: ${stats.with_prices} (${pct}%)`);
console.log(` Without prices: ${stats.without_prices}`);
console.log('');
await pool.end();
}
main().catch(console.error);