From 0460f8c945dd26059cfe5b4b119c21f9e576074c Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Wed, 1 Feb 2023 21:55:05 +0000 Subject: [PATCH] Fix logic for counting blog posts --- src/Robware.Data/BlogRepository.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Robware.Data/BlogRepository.cs b/src/Robware.Data/BlogRepository.cs index 00cb597..b35b556 100644 --- a/src/Robware.Data/BlogRepository.cs +++ b/src/Robware.Data/BlogRepository.cs @@ -35,7 +35,8 @@ namespace Robware.Data { public async Task> GetAllPostsAsync() => MapStateToPost((await _collection.FindAsync(post => !post.Deleted)).ToEnumerable()); - private async Task GetCountAsync(bool includeAll) => (int)await _collection.CountDocumentsAsync(post => includeAll || (!post.Deleted && string.IsNullOrEmpty(post.Content))); + private async Task GetCountAsync(bool includeAll) => + (int)await _collection.CountDocumentsAsync(post => includeAll || !(post.Deleted || string.IsNullOrEmpty(post.Content))); public async Task GetCountAsync() => await GetCountAsync(false);