MCPcopy Create free account
hub / github.com/chokcoco/iCSS / generateStats

Method generateStats

MCP/scripts/fetch-issues.js:825–859  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

823 }
824
825 generateStats() {
826 this.db.all('SELECT COUNT(*) as total FROM issues', (err, rows) => {
827 if (err) {
828 console.error('Error generating stats:', err);
829 return;
830 }
831
832 console.log('\n📊 Database Statistics:');
833 console.log(` Total articles: ${rows[0].total}`);
834
835 // 标签统计
836 this.db.all(`
837 SELECT labels, COUNT(*) as count
838 FROM issues
839 WHERE labels IS NOT NULL AND labels != '[]'
840 GROUP BY labels
841 ORDER BY count DESC
842 LIMIT 10
843 `, (err, labelRows) => {
844 if (err) {
845 console.error('Error getting label stats:', err);
846 return;
847 }
848
849 console.log('\n🏷️ Top 10 Label Combinations:');
850 labelRows.forEach((row, index) => {
851 const labels = JSON.parse(row.labels);
852 console.log(` ${index + 1}. ${labels.join(', ')} (${row.count} articles)`);
853 });
854
855 console.log('\n🎉 Database update completed!');
856 process.exit(0);
857 });
858 });
859 }
860
861 close() {
862 this.db.close();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected