add substep to check with atef if there is external ems

This commit is contained in:
Yinyin Liu 2026-05-05 09:12:29 +02:00
parent 1bda67fec6
commit 0c84cb3330
6 changed files with 37 additions and 5 deletions

View File

@ -57,7 +57,8 @@ public static class ChecklistStepDefinitions
""" """
[ [
{"text":"checklistStep10Sub1","checked":false}, {"text":"checklistStep10Sub1","checked":false},
{"text":"checklistStep10Sub2","checked":false} {"text":"checklistStep10Sub2","checked":false},
{"text":"checklistStep10Sub3","checked":false}
] ]
"""), """),
new(11, "Software verified on site", NoSubtasks), new(11, "Software verified on site", NoSubtasks),

View File

@ -149,17 +149,44 @@ public static partial class Db
"UPDATE ChecklistItem SET Subtasks = ? WHERE StepNumber = 8 AND (Subtasks IS NULL OR Subtasks = '')", "UPDATE ChecklistItem SET Subtasks = ? WHERE StepNumber = 8 AND (Subtasks IS NULL OR Subtasks = '')",
"[{\"text\":\"checklistStep8Sub1\",\"checked\":false}]"); "[{\"text\":\"checklistStep8Sub1\",\"checked\":false}]");
// One-time backfill: step 10 originally had no subtasks; add the two upload subtasks // One-time backfill: step 10 originally had no subtasks; add the upload subtasks
// (installation protocol + time & material report) to existing rows. // to existing rows.
Connection.Execute( Connection.Execute(
"UPDATE ChecklistItem SET Subtasks = ? WHERE StepNumber = 10 AND (Subtasks IS NULL OR Subtasks = '')", "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(); //UpdateKeys();
CleanupSessions().SupressAwaitWarning(); CleanupSessions().SupressAwaitWarning();
DeleteSnapshots().SupressAwaitWarning(); DeleteSnapshots().SupressAwaitWarning();
} }
private static void BackfillStep10Sub3()
{
var rows = Connection.Query<ChecklistItem>(
"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() private static SQLiteConnection InitConnection()
{ {

View File

@ -792,6 +792,7 @@
"checklistStep8Sub1": "Lieferschein mit Kundenunterschrift erhalten und hochgeladen", "checklistStep8Sub1": "Lieferschein mit Kundenunterschrift erhalten und hochgeladen",
"checklistStep10Sub1": "Installationsprotokoll hochgeladen", "checklistStep10Sub1": "Installationsprotokoll hochgeladen",
"checklistStep10Sub2": "Zeit- und Materialbericht in Monitoring hochgeladen", "checklistStep10Sub2": "Zeit- und Materialbericht in Monitoring hochgeladen",
"checklistStep10Sub3": "Atef kontaktieren, falls externes EMS vorhanden ist",
"checklistNoAttachments": "Noch keine Datei angehängt.", "checklistNoAttachments": "Noch keine Datei angehängt.",
"setupProgress": "Setup-Fortschritt", "setupProgress": "Setup-Fortschritt",
"checklistPhaseEmpty": "Nicht gestartet", "checklistPhaseEmpty": "Nicht gestartet",

View File

@ -540,6 +540,7 @@
"checklistStep8Sub1": "Delivery receipt with customer signature received and uploaded", "checklistStep8Sub1": "Delivery receipt with customer signature received and uploaded",
"checklistStep10Sub1": "Installation protocol uploaded", "checklistStep10Sub1": "Installation protocol uploaded",
"checklistStep10Sub2": "Time and material report uploaded to Monitoring", "checklistStep10Sub2": "Time and material report uploaded to Monitoring",
"checklistStep10Sub3": "Contact Atef if there is external EMS",
"checklistNoAttachments": "No file attached yet.", "checklistNoAttachments": "No file attached yet.",
"setupProgress": "Setup Progress", "setupProgress": "Setup Progress",
"checklistPhaseEmpty": "Not started", "checklistPhaseEmpty": "Not started",

View File

@ -792,6 +792,7 @@
"checklistStep8Sub1": "Bon de livraison signé par le client reçu et téléversé", "checklistStep8Sub1": "Bon de livraison signé par le client reçu et téléversé",
"checklistStep10Sub1": "Procès-verbal d'installation téléversé", "checklistStep10Sub1": "Procès-verbal d'installation téléversé",
"checklistStep10Sub2": "Rapport de temps et matériaux téléversé dans Monitoring", "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.", "checklistNoAttachments": "Aucun fichier joint pour le moment.",
"setupProgress": "Progression installation", "setupProgress": "Progression installation",
"checklistPhaseEmpty": "Non commencé", "checklistPhaseEmpty": "Non commencé",

View File

@ -792,6 +792,7 @@
"checklistStep8Sub1": "Bolla di consegna con firma del cliente ricevuta e caricata", "checklistStep8Sub1": "Bolla di consegna con firma del cliente ricevuta e caricata",
"checklistStep10Sub1": "Verbale di installazione caricato", "checklistStep10Sub1": "Verbale di installazione caricato",
"checklistStep10Sub2": "Rapporto tempi e materiali caricato su Monitoring", "checklistStep10Sub2": "Rapporto tempi e materiali caricato su Monitoring",
"checklistStep10Sub3": "Contattare Atef se è presente un EMS esterno",
"checklistNoAttachments": "Nessun file allegato.", "checklistNoAttachments": "Nessun file allegato.",
"setupProgress": "Avanzamento installazione", "setupProgress": "Avanzamento installazione",
"checklistPhaseEmpty": "Non avviato", "checklistPhaseEmpty": "Non avviato",