Automation final fixes

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-28 20:37:46 +00:00
parent 7f82ef4551
commit 748de099dd
8 changed files with 292 additions and 144 deletions

View File

@@ -754,14 +754,15 @@ const AutomationPage: React.FC = () => {
};
const resultTotal = result?.[totalKeyMap[stage.number]] ?? 0;
// pending = items still waiting to be processed (real-time from DB)
const pending = stage.pending ?? 0;
// For total: prioritize result total (set at stage start), then fallback to DB pending + processed
const dbPending = stage.pending ?? 0;
const total = resultTotal > 0 ? resultTotal : (isActive || isComplete ? dbPending + processed : dbPending);
// For active/completed stages: use result total if available, else pending + processed
// For pending stages: just show current pending count
const total = isActive || isComplete
? (resultTotal > 0 ? resultTotal : pending + processed)
: pending;
// FIXED: For active stages, "Pending" = items remaining = total - processed
// For inactive stages, "Pending" = items ready in queue (from DB)
const pending = isActive || isComplete
? Math.max(0, total - processed)
: dbPending;
const progressPercent = total > 0 ? Math.min(Math.round((processed / total) * 100), 100) : 0;
@@ -866,10 +867,15 @@ const AutomationPage: React.FC = () => {
6: 'images_total',
};
const resultTotal = result?.[totalKeyMap[stage.number]] ?? 0;
const pending = stage.pending ?? 0;
const total = isActive || isComplete
? (resultTotal > 0 ? resultTotal : pending + processed)
: pending;
// For total: prioritize result total (set at stage start), then fallback to DB pending + processed
const dbPending = stage.pending ?? 0;
const total = resultTotal > 0 ? resultTotal : (isActive || isComplete ? dbPending + processed : dbPending);
// FIXED: For active stages, "Pending" = items remaining = total - processed
const pending = isActive || isComplete
? Math.max(0, total - processed)
: dbPending;
const progressPercent = total > 0 ? Math.min(Math.round((processed / total) * 100), 100) : 0;