enrich and save sse
This commit is contained in:
@@ -66,11 +66,11 @@ function computeProgressPercent(
|
||||
if (status === "pending") return 0;
|
||||
if (status === "completed") return 100;
|
||||
|
||||
if (seenSteps.has("complete")) return 90;
|
||||
if (seenSteps.has("save_expenses") || seenSteps.has("complete")) return 95;
|
||||
if (seenSteps.has("enrich")) return 85;
|
||||
if (seenSteps.has("txn_dicts/completed")) return 80;
|
||||
|
||||
if (seenSteps.has("txn_dicts/started") && liveCount > 0) {
|
||||
if (seenSteps.has("txn_dicts") && liveCount > 0) {
|
||||
return Math.min(80, 35 + Math.min(liveCount, 300) / 300 * 45);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ const stepLabels = ["Load Content", "Extract", "Raw Expense", "Enrich", "Save"];
|
||||
|
||||
function computeActiveStep(status: FetchRequestStatus, seenSteps: Set<string>): number {
|
||||
if (status === "completed") return stepLabels.length;
|
||||
if (seenSteps.has("complete")) return 4;
|
||||
if (seenSteps.has("save_expenses") || seenSteps.has("complete")) return 4;
|
||||
if (seenSteps.has("enrich") || status === "enriched_done") return 3;
|
||||
if (seenSteps.has("txn_dicts") || status === "raw_expenses_done") return 2;
|
||||
if (seenSteps.has("txn_blocks")) return 1;
|
||||
@@ -155,9 +155,12 @@ export default function FetchRequestDetail() {
|
||||
const dictCount = stepStats.txn_dicts ?? liveParsedCount ?? 0;
|
||||
if (dictCount) msgs[2] = `${dictCount} dicts`;
|
||||
|
||||
if (["enriched_done", "completed"].includes((fetchRequest as any)?.status))
|
||||
if (stepStats.enrich_count) msgs[3] = `${stepStats.enrich_count} enriched`;
|
||||
else if (["enriched_done", "completed"].includes((fetchRequest as any)?.status))
|
||||
msgs[3] = "done";
|
||||
if ((fetchRequest as any)?.status === "completed")
|
||||
|
||||
if (stepStats.save_count) msgs[4] = `${stepStats.save_count} saved`;
|
||||
else if ((fetchRequest as any)?.status === "completed")
|
||||
msgs[4] = (fetchRequest as any)?.completed_at
|
||||
? new Date((fetchRequest as any).completed_at).toLocaleString() : "done";
|
||||
|
||||
@@ -181,11 +184,13 @@ export default function FetchRequestDetail() {
|
||||
setLiveParsedCount(parsed.message.count);
|
||||
}
|
||||
|
||||
if (parsed.status === "completed") {
|
||||
if (parsed.status === "completed" && parsed.message.count !== undefined) {
|
||||
const stats: Record<string, number> = {};
|
||||
if (parsed.step === "raw_lines" && parsed.message.lines !== undefined) stats.raw_lines = parsed.message.lines;
|
||||
if (parsed.step === "txn_blocks" && parsed.message.blocks !== undefined) stats.txn_blocks = parsed.message.blocks;
|
||||
if (parsed.step === "txn_dicts" && parsed.message.count !== undefined) stats.txn_dicts = parsed.message.count;
|
||||
if (parsed.step === "txn_dicts") stats.txn_dicts = parsed.message.count;
|
||||
if (parsed.step === "enrich") stats.enrich_count = parsed.message.count;
|
||||
if (parsed.step === "save_expenses") stats.save_count = parsed.message.count;
|
||||
if (Object.keys(stats).length) {
|
||||
setStepStats((prev) => ({ ...prev, ...stats }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user