This commit is contained in:
53
check-familynfriend-import.js
Normal file
53
check-familynfriend-import.js
Normal file
@@ -0,0 +1,53 @@
|
||||
const { sequelize } = require('./config/database');
|
||||
const { Vocab } = require('./models');
|
||||
|
||||
async function checkImport() {
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
console.log('✅ Database connection OK\n');
|
||||
|
||||
// Count all familynfriend vocabs
|
||||
const totalCount = await Vocab.count({
|
||||
where: { etc: 'familynfriend' }
|
||||
});
|
||||
|
||||
console.log(`📊 Total familynfriend vocabulary: ${totalCount}`);
|
||||
|
||||
// Get some sample records
|
||||
const samples = await Vocab.findAll({
|
||||
where: { etc: 'familynfriend' },
|
||||
limit: 10,
|
||||
order: [['grade', 'ASC']]
|
||||
});
|
||||
|
||||
console.log('\n📋 Sample records:');
|
||||
samples.forEach(v => {
|
||||
console.log(` - ${v.text} (grade: ${v.grade}, etc: ${v.etc})`);
|
||||
});
|
||||
|
||||
// Count by grade prefix
|
||||
const gradeCount = await sequelize.query(
|
||||
`SELECT
|
||||
FLOOR(grade / 100000) as grade_num,
|
||||
COUNT(*) as count
|
||||
FROM vocab
|
||||
WHERE etc = 'familynfriend'
|
||||
GROUP BY grade_num
|
||||
ORDER BY grade_num`,
|
||||
{ type: sequelize.QueryTypes.SELECT }
|
||||
);
|
||||
|
||||
console.log('\n📊 Count by grade:');
|
||||
gradeCount.forEach(g => {
|
||||
const gradeName = `Grade ${g.grade_num}`;
|
||||
console.log(` ${gradeName}: ${g.count} words`);
|
||||
});
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Error:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
checkImport();
|
||||
Reference in New Issue
Block a user