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
This commit is contained in:
Michel Roegl-Brunner
2025-10-24 22:02:56 +02:00
parent b40f5b788c
commit 6c982050da

View File

@@ -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