tractatus/scripts/check-sections.js
TheFlow ac2db33732 fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

21 lines
922 B
JavaScript

const { MongoClient } = require('mongodb');
(async () => {
const client = new MongoClient('mongodb://localhost:27017/tractatus_dev');
await client.connect();
const docs = await client.db('tractatus_dev').collection('documents')
.find({}, { projection: { slug: 1, title: 1, sections: 1, category: 1 } })
.sort({ slug: 1 })
.toArray();
const withSections = docs.filter(d => d.sections && d.sections.length > 0);
const without = docs.filter(d => !d.sections || d.sections.length === 0);
console.log('=== DOCUMENTS WITH SECTIONS (' + withSections.length + ') ===');
withSections.forEach(d => console.log('-', d.slug, '(' + d.sections.length + ' sections, cat:' + (d.category || 'none') + ')'));
console.log('\n=== DOCUMENTS WITHOUT SECTIONS (' + without.length + ') ===');
without.forEach(d => console.log('-', d.slug, '(cat:' + (d.category || 'none') + ')'));
await client.close();
})();