Skip to content

Commit

Permalink
feat: add labeled covered repo count stat
Browse files Browse the repository at this point in the history
Signed-off-by: frank-zsy <[email protected]>
  • Loading branch information
frank-zsy committed Nov 28, 2024
1 parent bb467ab commit c8411c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/scripts/label_stats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getLabelData } from "../label_data_utils";
import { query } from "../db/clickhouse";
import { getLabelData, getPlatformData } from "../label_data_utils";

(async () => {
const labels = getLabelData();
Expand All @@ -16,4 +17,10 @@ import { getLabelData } from "../label_data_utils";
}
}

const labelPlatform = getPlatformData(['Region-0', 'Company', 'Community', 'Project', 'Foundation', 'Tech-0', 'Domain-0', 'Bot']);
const repoCount = await query<number[]>(`SELECT COUNT(DISTINCT repo_id) FROM events WHERE ${labelPlatform.map(p =>
`(((repo_id IN (${p.repos.map(r => r.id).join(',')})) OR (org_id IN (${p.orgs.map(r => r.id).join(',')}))) AND platform='${p.name}')`
).join(' OR ')}`);
console.table(`Repos covered by labels: ${repoCount[0][0]}`);

})();

0 comments on commit c8411c5

Please sign in to comment.