From 0a5491b9722c688fca2433f27af44d4a491ced44 Mon Sep 17 00:00:00 2001 From: Alexander Preibisch Date: Mon, 16 Oct 2023 14:19:53 +0200 Subject: [PATCH] Potentially fixed crashes on Rules page due to an unnecessary parallel initialization #165 --- CHANGELOG.md | 4 ++++ OpenBudgeteer.Blazor/Shared/NavMenu.razor | 2 +- .../ItemViewModels/RuleSetViewModelItem.cs | 14 +------------- OpenBudgeteer.Core/ViewModels/RulesViewModel.cs | 1 - 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e65049b..000b98a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 1.7.1 (2023-10-16) + +* [Fixed] Potentially fixed crashes on Rules page due to an unnecessary parallel initialization [#165](https://github.com/TheAxelander/OpenBudgeteer/issues/165) + ### 1.7 (2023-10-03) * [Add] PostgreSQL support [#81](https://github.com/TheAxelander/OpenBudgeteer/issues/81) Thanks [csillaggyujto](https://github.com/csillaggyujto) diff --git a/OpenBudgeteer.Blazor/Shared/NavMenu.razor b/OpenBudgeteer.Blazor/Shared/NavMenu.razor index ab79411..cb2197c 100644 --- a/OpenBudgeteer.Blazor/Shared/NavMenu.razor +++ b/OpenBudgeteer.Blazor/Shared/NavMenu.razor @@ -61,7 +61,7 @@
diff --git a/OpenBudgeteer.Core/ViewModels/ItemViewModels/RuleSetViewModelItem.cs b/OpenBudgeteer.Core/ViewModels/ItemViewModels/RuleSetViewModelItem.cs index c673f0b..e60dff4 100644 --- a/OpenBudgeteer.Core/ViewModels/ItemViewModels/RuleSetViewModelItem.cs +++ b/OpenBudgeteer.Core/ViewModels/ItemViewModels/RuleSetViewModelItem.cs @@ -91,19 +91,7 @@ public RuleSetViewModelItem(DbContextOptions dbOptions) Name = "No Selection" }); using var dbContext = new DatabaseContext(_dbOptions); - AvailableBuckets.Add(dbContext.Bucket.First(i => - i.BucketId == Guid.Parse("00000000-0000-0000-0000-000000000001"))); - AvailableBuckets.Add(dbContext.Bucket.First(i => - i.BucketId == Guid.Parse("00000000-0000-0000-0000-000000000002"))); - - var query = dbContext.Bucket - .Where(i => - i.BucketId != Guid.Parse("00000000-0000-0000-0000-000000000001") && - i.BucketId != Guid.Parse("00000000-0000-0000-0000-000000000002") && - !i.IsInactive) - .OrderBy(i => i.Name); - - foreach (var availableBucket in query.ToList()) + foreach (var availableBucket in dbContext.Bucket.Where(i => !i.IsInactive).ToList()) { AvailableBuckets.Add(availableBucket); } diff --git a/OpenBudgeteer.Core/ViewModels/RulesViewModel.cs b/OpenBudgeteer.Core/ViewModels/RulesViewModel.cs index 2e34f3f..c46691f 100644 --- a/OpenBudgeteer.Core/ViewModels/RulesViewModel.cs +++ b/OpenBudgeteer.Core/ViewModels/RulesViewModel.cs @@ -42,7 +42,6 @@ public RulesViewModel(DbContextOptions dbOptions) { _dbOptions = dbOptions; RuleSets = new ObservableCollection(); - ResetNewRuleSet(); } ///