From ba9cca057e46c24f0db13c840cc05e73c336970a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 1 Dec 2017 08:59:00 -0500 Subject: [PATCH] break apart query filter to make more readable --- .../TableStorage/EventRepository.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Core/Repositories/TableStorage/EventRepository.cs b/src/Core/Repositories/TableStorage/EventRepository.cs index ee353dc8c..14bf74ba3 100644 --- a/src/Core/Repositories/TableStorage/EventRepository.cs +++ b/src/Core/Repositories/TableStorage/EventRepository.cs @@ -27,15 +27,17 @@ namespace Bit.Core.Repositories.TableStorage var start = CoreHelpers.DateTimeToTableStorageKey(startDate); var end = CoreHelpers.DateTimeToTableStorageKey(endDate); - var query = new TableQuery().Where( - TableQuery.CombineFilters( - TableQuery.CombineFilters( - TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, $"UserId={userId}"), - TableOperators.And, - TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, $"{start}_")), - TableOperators.And, - TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, $"{end}`"))); + var rowFilter = TableQuery.CombineFilters( + TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, $"{start}_"), + TableOperators.And, + TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, $"{end}`")); + var filter = TableQuery.CombineFilters( + TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, $"UserId={userId}"), + TableOperators.And, + rowFilter); + + var query = new TableQuery().Where(filter); var results = new List(); TableContinuationToken continuationToken = null; do