Introduce checkup_checked/checkup_fixed on paintings with Checkup page filters and API. Fixed paintings auto-mark as reviewed. Add find-duplicates tooling and document debug/checkup workflow. Include Botticelli and Michelangelo image fixes from checkup. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
require('dotenv').config();
|
|
const pool = require('../server/db');
|
|
|
|
async function main() {
|
|
const sameWiki = await pool.query(`
|
|
SELECT a.name AS artist, p.wikipedia_title, COUNT(*)::int AS cnt,
|
|
array_agg(p.id ORDER BY p.id) AS ids,
|
|
array_agg(p.title ORDER BY p.id) AS titles,
|
|
array_agg(COALESCE(p.year::text, '?') ORDER BY p.id) AS years
|
|
FROM paintings p
|
|
JOIN artists a ON a.id = p.artist_id
|
|
WHERE p.wikipedia_title IS NOT NULL AND p.wikipedia_title <> ''
|
|
GROUP BY a.id, a.name, p.wikipedia_title
|
|
HAVING COUNT(*) > 1
|
|
ORDER BY cnt DESC, a.name
|
|
LIMIT 30
|
|
`);
|
|
|
|
const sameImage = await pool.query(`
|
|
SELECT a.name AS artist, p.image_path, COUNT(*)::int AS cnt,
|
|
array_agg(p.id ORDER BY p.id) AS ids,
|
|
array_agg(p.title ORDER BY p.id) AS titles
|
|
FROM paintings p
|
|
JOIN artists a ON a.id = p.artist_id
|
|
WHERE p.image_path IS NOT NULL AND p.image_path <> ''
|
|
GROUP BY a.id, a.name, p.image_path
|
|
HAVING COUNT(*) > 1
|
|
ORDER BY cnt DESC, a.name
|
|
LIMIT 20
|
|
`);
|
|
|
|
console.log('=== Same Wikipedia title (different painting rows) ===');
|
|
console.log(`Groups: ${sameWiki.rows.length} shown (top 30)`);
|
|
for (const row of sameWiki.rows) {
|
|
console.log(`\n[${row.cnt}x] ${row.artist} — wiki: "${row.wikipedia_title}"`);
|
|
row.titles.forEach((t, i) => console.log(` id ${row.ids[i]}: "${t}" (${row.years[i]})`));
|
|
}
|
|
|
|
console.log('\n=== Same image file (different painting rows) ===');
|
|
for (const row of sameImage.rows) {
|
|
console.log(`\n[${row.cnt}x] ${row.artist} — ${row.image_path}`);
|
|
row.titles.forEach((t, i) => console.log(` id ${row.ids[i]}: "${t}"`));
|
|
}
|
|
|
|
await pool.end();
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|