From 525893331276088e3ee7719bb1f7634016cf3a51 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Mon, 22 Jan 2024 14:08:50 -0600 Subject: [PATCH] Allow disabling readonly categories --- JournalApp/Data/AppDbSeeder.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/JournalApp/Data/AppDbSeeder.cs b/JournalApp/Data/AppDbSeeder.cs index b5aef97..6d00a8b 100644 --- a/JournalApp/Data/AppDbSeeder.cs +++ b/JournalApp/Data/AppDbSeeder.cs @@ -55,13 +55,18 @@ void AddOrUpdate( category.Group = group; category.ReadOnly = readOnly; + // Only set these properties if the category is new. + if (!doesExist) + { + category.Enabled = enabled; + } + // Overwrite some flexible properties if it doesn't already exist OR is readonly and isn't allowed to change. if (!doesExist || readOnly) { category.Type = type; category.Name = name; category.Details = details; - category.Enabled = enabled; category.MedicationDose = medDose; category.MedicationEveryDaySince = medEveryDaySince; category.MedicationUnit = medUnit;