Skip to content

Commit

Permalink
psp-8133 do not show retired properties unless isretired specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Mar 26, 2024
1 parent 03dcf4e commit 4fd88a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions source/backend/dal/Helpers/Extensions/PropertyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ private static ExpressionStarter<PimsProperty> GenerateCommonPropertyQuery(Claim
ownershipBuilder = isRetired ? PredicateBuilder.New<PimsProperty>(p => p.IsRetired == true) : PredicateBuilder.New<PimsProperty>(p => false);
if (filter.Ownership.Contains("isCoreInventory"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsOwned);
ownershipBuilder = ownershipBuilder.Or(p => p.IsOwned && p.IsRetired != true);
}
if (filter.Ownership.Contains("isPropertyOfInterest"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsPropertyOfInterest);
ownershipBuilder = ownershipBuilder.Or(p => p.IsPropertyOfInterest && p.IsRetired != true);
}
if (filter.Ownership.Contains("isOtherInterest"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsOtherInterest);
ownershipBuilder = ownershipBuilder.Or(p => p.IsOtherInterest && p.IsRetired != true);
}
if (filter.Ownership.Contains("isDisposed"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsDisposed);
ownershipBuilder = ownershipBuilder.Or(p => p.IsDisposed && p.IsRetired != true);
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class PropertyRepositoryTest
new object[] { new PropertyFilter(), 7 },
new object[] { new PropertyFilter(){ Ownership = new List<string>(){"isCoreInventory", "isPropertyOfInterest"}}, 4 },
new object[] { new PropertyFilter(){ Ownership = new List<string>(){"isDisposed"}}, 1 },
new object[] { new PropertyFilter(){ Ownership = new List<string>(){"isRetired"}}, 1 },
new object[] { new PropertyFilter(){ Ownership = new List<string>(){"isRetired"}}, 2 },
new object[] { new PropertyFilter(){ Ownership = new List<string>(){"isOtherInterest"}}, 1 },
new object[] { new PropertyFilter(){ Ownership = new List<string>(){"isCoreInventory"}}, 3 },
};
Expand Down Expand Up @@ -118,6 +118,9 @@ public void GetPage_Properties(PropertyFilter filter, int expectedCount)
testProperty.IsRetired = true;
testProperty = init.CreateProperty(33333);
testProperty.SurveyPlanNumber = "SP-89TTXY";
testProperty = init.CreateProperty(44444);
testProperty.IsRetired = true;
testProperty.IsOwned = true;

init.SaveChanges();

Expand Down

0 comments on commit 4fd88a3

Please sign in to comment.