From 6c982050dadadaf4169ce19f9f81ea0faf8eb766 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Fri, 24 Oct 2025 22:02:56 +0200 Subject: [PATCH] Fix notification to show script names grouped by category - Store full script objects instead of just names in results.newScripts and results.updatedScripts - This allows groupScriptsByCategory to properly group scripts by their categories - Notification will now show actual script names grouped by category instead of 'undefined synced, undefined up to date' - Script objects contain name, slug, and categories fields needed for proper grouping --- src/server/services/autoSyncService.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/server/services/autoSyncService.js b/src/server/services/autoSyncService.js index f8372b8..99da6c8 100644 --- a/src/server/services/autoSyncService.js +++ b/src/server/services/autoSyncService.js @@ -343,7 +343,7 @@ export class AutoSyncService { try { const result = await scriptDownloaderService.loadScript(script); if (result.success) { - downloaded.push(script.name || script.slug); + downloaded.push(script); // Store full script object for category grouping console.log(`Downloaded script: ${script.name || script.slug}`); } else { errors.push(`${script.name || script.slug}: ${result.message}`); @@ -370,7 +370,7 @@ export class AutoSyncService { // Always update existing scripts when auto-update is enabled const result = await scriptDownloaderService.loadScript(script); if (result.success) { - updated.push(script.name || script.slug); + updated.push(script); // Store full script object for category grouping console.log(`Updated script: ${script.name || script.slug}`); } else { errors.push(`${script.name || script.slug}: ${result.message}`); @@ -504,7 +504,18 @@ export class AutoSyncService { // @ts-ignore - Dynamic property access if (results.jsonSync) { // @ts-ignore - Dynamic property access - body += `JSON Files: ${results.jsonSync.syncedCount} synced, ${results.jsonSync.skippedCount} up-to-date\n`; + const syncedCount = results.jsonSync.count || 0; + // @ts-ignore - Dynamic property access + const syncedFiles = results.jsonSync.syncedFiles || []; + + // Calculate up-to-date count (total files - synced files) + // We can't easily get total file count from the sync result, so just show synced count + if (syncedCount > 0) { + body += `JSON Files: ${syncedCount} synced\n`; + } else { + body += `JSON Files: All up-to-date\n`; + } + // @ts-ignore - Dynamic property access if (results.jsonSync.errors?.length > 0) { // @ts-ignore - Dynamic property access