Skip to content

Commit

Permalink
Allow disabling readonly categories
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers committed Jan 22, 2024
1 parent 413ea7b commit 5258933
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion JournalApp/Data/AppDbSeeder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5258933

Please sign in to comment.