Skip to content

Build your personal knowledge base with Trilium Notes

fix the maths for stats

perf3ct8d7e5c8d43e2
diff --git a/src/services/llm/embeddings/stats.ts b/src/services/llm/embeddings/stats.ts
index fcb70cc193..ecc2ef6a8d 100644
--- a/src/services/llm/embeddings/stats.ts
+++ b/src/services/llm/embeddings/stats.ts
@@ -32,11 +32,11 @@ export async function getEmbeddingStats() {
) as number;
const queuedNotesCount = await sql.getValue(
- "SELECT COUNT(*) FROM embedding_queue"
+ "SELECT COUNT(*) FROM embedding_queue WHERE failed = 0"
) as number;
const failedNotesCount = await sql.getValue(
- "SELECT COUNT(*) FROM embedding_queue WHERE attempts > 0"
+ "SELECT COUNT(*) FROM embedding_queue WHERE failed = 1"
) as number;
// Get the last processing time by checking the most recent embedding
@@ -60,7 +60,7 @@ export async function getEmbeddingStats() {
// Calculate the percentage of notes that are properly embedded
const percentComplete = totalNotesCount > 0
- ? Math.round((upToDateEmbeddings / totalNotesCount) * 100)
+ ? Math.round((upToDateEmbeddings / (totalNotesCount - failedNotesCount)) * 100)
: 0;
return {