diff --git a/csharp/App/Backend/DataTypes/ChecklistStepDefinitions.cs b/csharp/App/Backend/DataTypes/ChecklistStepDefinitions.cs index 3e64d2d68..71cb985bb 100644 --- a/csharp/App/Backend/DataTypes/ChecklistStepDefinitions.cs +++ b/csharp/App/Backend/DataTypes/ChecklistStepDefinitions.cs @@ -57,7 +57,8 @@ public static class ChecklistStepDefinitions """ [ {"text":"checklistStep10Sub1","checked":false}, - {"text":"checklistStep10Sub2","checked":false} + {"text":"checklistStep10Sub2","checked":false}, + {"text":"checklistStep10Sub3","checked":false} ] """), new(11, "Software verified on site", NoSubtasks), diff --git a/csharp/App/Backend/Database/Db.cs b/csharp/App/Backend/Database/Db.cs index 4bdd7b2bb..2e3548e50 100644 --- a/csharp/App/Backend/Database/Db.cs +++ b/csharp/App/Backend/Database/Db.cs @@ -149,18 +149,45 @@ public static partial class Db "UPDATE ChecklistItem SET Subtasks = ? WHERE StepNumber = 8 AND (Subtasks IS NULL OR Subtasks = '')", "[{\"text\":\"checklistStep8Sub1\",\"checked\":false}]"); - // One-time backfill: step 10 originally had no subtasks; add the two upload subtasks - // (installation protocol + time & material report) to existing rows. + // One-time backfill: step 10 originally had no subtasks; add the upload subtasks + // to existing rows. Connection.Execute( "UPDATE ChecklistItem SET Subtasks = ? WHERE StepNumber = 10 AND (Subtasks IS NULL OR Subtasks = '')", - "[{\"text\":\"checklistStep10Sub1\",\"checked\":false},{\"text\":\"checklistStep10Sub2\",\"checked\":false}]"); + "[{\"text\":\"checklistStep10Sub1\",\"checked\":false},{\"text\":\"checklistStep10Sub2\",\"checked\":false},{\"text\":\"checklistStep10Sub3\",\"checked\":false}]"); + + // One-time backfill: append step 10 sub3 (contact Atef for external EMS) to rows + // that already have subtasks but lack sub3. Done in C# to handle the multi-line + // raw-string JSON form preserving each row's existing checked state. + BackfillStep10Sub3(); //UpdateKeys(); CleanupSessions().SupressAwaitWarning(); DeleteSnapshots().SupressAwaitWarning(); } - + private static void BackfillStep10Sub3() + { + var rows = Connection.Query( + "SELECT * FROM ChecklistItem WHERE StepNumber = 10 AND Subtasks IS NOT NULL AND Subtasks != ''"); + foreach (var row in rows) + { + if (row.Subtasks is null) continue; + if (row.Subtasks.Contains("checklistStep10Sub3")) continue; + + // Insert sub3 before the closing bracket. Works regardless of indentation/whitespace + // since we only look for the last `]`. + var lastBracket = row.Subtasks.LastIndexOf(']'); + if (lastBracket < 0) continue; + + var head = row.Subtasks.Substring(0, lastBracket).TrimEnd(); + // head ends with `}` of the last existing subtask. + var newJson = head + ",{\"text\":\"checklistStep10Sub3\",\"checked\":false}]"; + Connection.Execute( + "UPDATE ChecklistItem SET Subtasks = ? WHERE Id = ?", + newJson, row.Id); + } + } + private static SQLiteConnection InitConnection() { var latestDb = new DirectoryInfo("DbBackups") diff --git a/typescript/frontend-marios2/src/lang/de.json b/typescript/frontend-marios2/src/lang/de.json index a1b4c134a..84adaec01 100644 --- a/typescript/frontend-marios2/src/lang/de.json +++ b/typescript/frontend-marios2/src/lang/de.json @@ -792,6 +792,7 @@ "checklistStep8Sub1": "Lieferschein mit Kundenunterschrift erhalten und hochgeladen", "checklistStep10Sub1": "Installationsprotokoll hochgeladen", "checklistStep10Sub2": "Zeit- und Materialbericht in Monitoring hochgeladen", + "checklistStep10Sub3": "Atef kontaktieren, falls externes EMS vorhanden ist", "checklistNoAttachments": "Noch keine Datei angehängt.", "setupProgress": "Setup-Fortschritt", "checklistPhaseEmpty": "Nicht gestartet", diff --git a/typescript/frontend-marios2/src/lang/en.json b/typescript/frontend-marios2/src/lang/en.json index d0a83ae9a..4c465cca0 100644 --- a/typescript/frontend-marios2/src/lang/en.json +++ b/typescript/frontend-marios2/src/lang/en.json @@ -540,6 +540,7 @@ "checklistStep8Sub1": "Delivery receipt with customer signature received and uploaded", "checklistStep10Sub1": "Installation protocol uploaded", "checklistStep10Sub2": "Time and material report uploaded to Monitoring", + "checklistStep10Sub3": "Contact Atef if there is external EMS", "checklistNoAttachments": "No file attached yet.", "setupProgress": "Setup Progress", "checklistPhaseEmpty": "Not started", diff --git a/typescript/frontend-marios2/src/lang/fr.json b/typescript/frontend-marios2/src/lang/fr.json index 612637034..0a9d2c704 100644 --- a/typescript/frontend-marios2/src/lang/fr.json +++ b/typescript/frontend-marios2/src/lang/fr.json @@ -792,6 +792,7 @@ "checklistStep8Sub1": "Bon de livraison signé par le client reçu et téléversé", "checklistStep10Sub1": "Procès-verbal d'installation téléversé", "checklistStep10Sub2": "Rapport de temps et matériaux téléversé dans Monitoring", + "checklistStep10Sub3": "Contacter Atef en cas d'EMS externe", "checklistNoAttachments": "Aucun fichier joint pour le moment.", "setupProgress": "Progression installation", "checklistPhaseEmpty": "Non commencé", diff --git a/typescript/frontend-marios2/src/lang/it.json b/typescript/frontend-marios2/src/lang/it.json index ed9791520..bf231f3c5 100644 --- a/typescript/frontend-marios2/src/lang/it.json +++ b/typescript/frontend-marios2/src/lang/it.json @@ -792,6 +792,7 @@ "checklistStep8Sub1": "Bolla di consegna con firma del cliente ricevuta e caricata", "checklistStep10Sub1": "Verbale di installazione caricato", "checklistStep10Sub2": "Rapporto tempi e materiali caricato su Monitoring", + "checklistStep10Sub3": "Contattare Atef se è presente un EMS esterno", "checklistNoAttachments": "Nessun file allegato.", "setupProgress": "Avanzamento installazione", "checklistPhaseEmpty": "Non avviato",