feat: show the German/French drop count in the digest
Jobs rejected for German/French content never reach jobs.csv, so daily.ts had no way to see they existed — the digest silently under-reported how much the run actually looked at. index.ts now counts them across both the LinkedIn and extra-source paths and writes results/.lang-dropped.json; daily.ts reads it back, keyed on the digest date, and appends a count-only category. Count-only because there is no Row to list — these were dropped before ever being parsed.
This commit is contained in:
@@ -54,6 +54,7 @@ try {
|
||||
|
||||
const date = new Date().toISOString().slice(0, 10);
|
||||
const newRows: string[] = [];
|
||||
let totalLangDropped = 0; // jobs dropped for German/French content — never reach the CSV, so daily.ts can't see them on its own
|
||||
|
||||
function csvCell(val: string): string {
|
||||
return `"${val.replace(/"/g, '""')}"`;
|
||||
@@ -111,6 +112,7 @@ async function processLinkedInSearch(config: (typeof searches)[number]): Promise
|
||||
if (!viable.ok) {
|
||||
console.log(`dropped (${viable.reason})`);
|
||||
langDropped++;
|
||||
totalLangDropped++;
|
||||
continue;
|
||||
}
|
||||
console.log("ok");
|
||||
@@ -162,6 +164,7 @@ async function processExtraSource({ label, fetch: fetchFn }: (typeof extraSource
|
||||
if (!viable.ok) {
|
||||
console.log(`dropped (${viable.reason})`);
|
||||
langDropped++;
|
||||
totalLangDropped++;
|
||||
continue;
|
||||
}
|
||||
console.log("ok");
|
||||
@@ -184,6 +187,12 @@ await Promise.all([
|
||||
runWithConcurrency(extraSources, EXTRA_SOURCE_CONCURRENCY, processExtraSource),
|
||||
]);
|
||||
|
||||
// Jobs dropped for German/French content never reach the CSV, so this is the
|
||||
// only record of them — daily.ts reads it back to show a count in the digest
|
||||
// without listing rejects that were never even parsed into a Row.
|
||||
const LANG_DROPPED = "./results/.lang-dropped.json";
|
||||
await Bun.write(LANG_DROPPED, JSON.stringify({ date, count: totalLangDropped }));
|
||||
|
||||
if (newRows.length === 0) {
|
||||
console.log("\nNo new jobs.");
|
||||
process.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user