Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
const { pool } = require('./src/db');
|
||||
|
||||
async function run() {
|
||||
const days = await pool.query('SELECT DISTINCT DATE(crawled_at) as d FROM crawls ORDER BY d');
|
||||
console.log('\n=== Unique crawl days ===');
|
||||
for (const r of days.rows) console.log(' ', r.d);
|
||||
|
||||
// What the position-history query actually returns for Mr Q / Top10OnlineSlots
|
||||
const pos = await pool.query(
|
||||
'SELECT DISTINCT ON (DATE(c.crawled_at)) DATE(c.crawled_at)::text AS day, ca.position FROM crawls c JOIN casinos ca ON ca.crawl_id = c.id WHERE ca.casino_name = $1 AND c.site_name = $2 ORDER BY DATE(c.crawled_at), c.crawled_at ASC',
|
||||
['Mr Q', 'Top10OnlineSlots']
|
||||
);
|
||||
console.log('\n=== Position history (current query) ===');
|
||||
console.log('Records:', pos.rows.length);
|
||||
for (const r of pos.rows) console.log(' Day:', r.day, '| Pos:', r.position);
|
||||
|
||||
await pool.end();
|
||||
}
|
||||
|
||||
run();
|
||||
process.on('exit', () => process.exit(0));
|
||||
Reference in New Issue
Block a user