Fix saveQueue() called without argument in job_filter.mjs

Iterate over the full queue array instead of getJobsByStatus() results,
and pass it to saveQueue(). The previous code passed no argument, which
would corrupt or silently fail the save.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 19:50:27 -08:00
parent 273a32e571
commit 73887318b2

View File

@@ -212,15 +212,16 @@ async function submit(settings, searchConfig, candidateProfile) {
const stateExists = existsSync(resolve(__dir, 'data/filter_state.json'));
if (!stateExists) {
let cleared = 0;
for (const j of getJobsByStatus('new')) {
if (j.filter_score == null && j.filter_batch_id) {
const queue = loadQueue();
for (const j of queue) {
if (j.status === 'new' && j.filter_score == null && j.filter_batch_id) {
delete j.filter_batch_id;
delete j.filter_submitted_at;
cleared++;
}
}
if (cleared > 0) {
saveQueue();
saveQueue(queue);
console.log(`🔄 Cleared ${cleared} stale batch markers (batch completed without scoring)`);
}
}