Dashboard: Nuggets attention line counts uploads still open in the workflow and clears when finished; v2.21.0
Publish Container / build (push) Successful in 16m6s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-12 12:02:30 -04:00
1 parent 35d3c9ca33
commit e6bef529e6
5 files changed
+19 -8

No files matched your search

+11 -2
View File
@@ -26,7 +26,7 @@ const AUDIO_TYPES = {
export const WORKFLOW_STEPS = ['listen', 'coldOpen', 'recordColdOpen', 'edit', 'spotify']
async function loadWorkflow() {
export async function loadWorkflow() {
try {
return JSON.parse(await readFile(WORKFLOW_FILE, 'utf8'))
} catch {
@@ -34,7 +34,7 @@ async function loadWorkflow() {
}
}
function entryId(entry) {
export function entryId(entry) {
return createHash('sha1').update(`${entry.uploadedAt}|${entry.filename}`).digest('hex').slice(0, 16)
}
@@ -51,6 +51,15 @@ function seafileConfigured() {
return Boolean(SEAFILE_URL && SEAFILE_TOKEN && SEAFILE_NUGGETS_REPO_ID)
}
// Portal uploads whose workflow still has steps left to do (any age, so an old one keeps showing).
export async function countPendingUploads() {
const [history, wf] = await Promise.all([loadHistory(), loadWorkflow()])
return history.entries.filter(entry => {
const steps = wf.items[entryId(entry)]?.steps ?? {}
return !WORKFLOW_STEPS.every(step => steps[step])
}).length
}
export function register(app) {
app.get('/api/admin/nuggets-workflow', requireAdminAuth, async (_req, res) => {
const [history, wf] = await Promise.all([loadHistory(), loadWorkflow()])