-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psp-7598 | Properties list view filter by ownership #3781
Changes from 3 commits
0211bfd
2833075
7ecaaf6
fac83d0
e01a479
9887e22
58d9274
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Pims.Core.Extensions; | ||
using Pims.Dal.Entities.Models; | ||
|
||
|
@@ -27,6 +28,11 @@ public class PropertyFilterModel : PageFilter | |
/// </summary> | ||
public string PlanNumber { get; set; } | ||
|
||
/// <summary> | ||
/// get/set - The property ownership status. | ||
/// </summary> | ||
public IList<string> Ownership { get; set; } | ||
|
||
#endregion | ||
|
||
#region Constructors | ||
|
@@ -49,10 +55,32 @@ public PropertyFilterModel(Dictionary<string, Microsoft.Extensions.Primitives.St | |
var filter = new Dictionary<string, Microsoft.Extensions.Primitives.StringValues>(query, StringComparer.OrdinalIgnoreCase); | ||
|
||
this.Sort = filter.GetStringArrayValue(nameof(this.Sort)); | ||
var tempSort = this.Sort.ToList(); | ||
|
||
// Convert sort to db format | ||
for (int i = 0; i < this.Sort.Length; i++) | ||
{ | ||
if (tempSort[i].StartsWith("Location")) | ||
{ | ||
tempSort[i] = tempSort[i].Replace("Location", "Address.MunicipalityName"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't check the story, but are we sure location maps to municipality (I know we also have a general location field in the db) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
if (tempSort[i].StartsWith("Ownership")) | ||
{ | ||
// The order will affect the display in the frontend. For now in alphabetical order. | ||
// i.e. [Core Inventory, Disposed, Other Interest, Property of Interest] | ||
var direction = this.Sort[i].Split(' ')[1]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this safe (ie. we always have a direction of asc or desc)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, the sort expects a direction to be able to be process later |
||
tempSort[i] = this.Sort[i].Replace("Ownership", "IsOwned"); | ||
tempSort.Add($"IsDisposed {direction}"); | ||
tempSort.Add($"IsOtherInterest {direction}"); | ||
tempSort.Add($"IsPropertyOfInterest {direction}"); | ||
} | ||
} | ||
this.Sort = tempSort.ToArray(); | ||
|
||
this.PinOrPid = filter.GetStringValue(nameof(this.PinOrPid)); | ||
this.Address = filter.GetStringValue(nameof(this.Address)); | ||
this.PlanNumber = filter.GetStringValue(nameof(this.PlanNumber)); | ||
this.Ownership = filter.GetStringArrayValue(nameof(this.Ownership)); | ||
} | ||
#endregion | ||
|
||
|
@@ -73,6 +101,7 @@ public static explicit operator PropertyFilter(PropertyFilterModel model) | |
PinOrPid = model.PinOrPid, | ||
Address = model.Address, | ||
PlanNumber = model.PlanNumber, | ||
Ownership = model.Ownership, | ||
}; | ||
|
||
return filter; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little nervous about these map deletions since mapping errors only show up at runtime. Since this is a release sprint, are you 100% confident these deletions are safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, given that the model it was mapping was deleted I have confidence it was not being used anywhere else, and therefore, not mapped