fix the maths for stats

This commit is contained in:
perf3ct 2025-03-12 21:18:59 +00:00
parent d4cfc65b27
commit 8d7e5c8d43
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232

View File

@ -32,11 +32,11 @@ export async function getEmbeddingStats() {
) as number; ) as number;
const queuedNotesCount = await sql.getValue( const queuedNotesCount = await sql.getValue(
"SELECT COUNT(*) FROM embedding_queue" "SELECT COUNT(*) FROM embedding_queue WHERE failed = 0"
) as number; ) as number;
const failedNotesCount = await sql.getValue( const failedNotesCount = await sql.getValue(
"SELECT COUNT(*) FROM embedding_queue WHERE attempts > 0" "SELECT COUNT(*) FROM embedding_queue WHERE failed = 1"
) as number; ) as number;
// Get the last processing time by checking the most recent embedding // 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 // Calculate the percentage of notes that are properly embedded
const percentComplete = totalNotesCount > 0 const percentComplete = totalNotesCount > 0
? Math.round((upToDateEmbeddings / totalNotesCount) * 100) ? Math.round((upToDateEmbeddings / (totalNotesCount - failedNotesCount)) * 100)
: 0; : 0;
return { return {