Skip to content

1366 filtering on some pages broken#1371

Open
PhilBradbury wants to merge 16 commits into
devfrom
1366-filtering-on-some-pages-broken
Open

1366 filtering on some pages broken#1371
PhilBradbury wants to merge 16 commits into
devfrom
1366-filtering-on-some-pages-broken

Conversation

@PhilBradbury

Copy link
Copy Markdown
Contributor

Closes #1366

…er on it as a simple integer where required.
…Name property rather than custom filtering based on pattern matching and Linq.
…nager filtering. Also adjusted filtering by CurrentGrade to use a calculated integer value.
…te rather than being set in the calling code.
@PhilBradbury PhilBradbury linked an issue Jun 10, 2026 that may be closed by this pull request
2 tasks
@PhilBradbury PhilBradbury self-assigned this Jun 10, 2026
Adjusted Faculty and School filtering to use the Code for each as the filterable property.
Removed filter from some columns where it didn't make much sense (costs, day rate, dates etc.)
@PhilBradbury PhilBradbury marked this pull request as ready for review June 10, 2026 12:51
@aharwood2 aharwood2 added this to the v1.14.0.1 milestone Jun 11, 2026

@aharwood2 aharwood2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this probably needs a walkthrough so I can see the differences more clearly. Will need to check that the changes don't alter the UX in a way they might not like.

Comment thread PPMTool/Pages/Projects.razor
Comment thread PPMTool/Pages/Projects.razor.cs
Comment thread PPMTool/Pages/Projects.razor Outdated
Comment thread PPMTool/Pages/People.razor.cs
@PhilBradbury

Copy link
Copy Markdown
Contributor Author

Walkthrough video now available at: https://www.loom.com/share/f3190d9bb90a4faeab6a5f51ef56f16e

The egregious bracket after the value in one of the monetary columns has been removed.

@sjmf

sjmf commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Walkthrough video now available at: https://www.loom.com/share/f3190d9bb90a4faeab6a5f51ef56f16e

Very nice @PhilBradbury - thanks much!

@aharwood2 aharwood2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still on the fence with this approach. It could also relate to how we manage derived properties via #1375 as well. I might as Co-Pilot to review it and see if it has any useful insights.

/// </summary>
/// <returns></returns>
[NotMapped]
public double FundsReceived { get; set; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me nervous as we have a property on a model that is invalid most of the time and is only populated correctly in a very specific context.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it doesn't feel like the best way to do it, but it's either this or injecting a service to be able to to a getter that retrieves the calculated figure.. and then we're making it less decoupled (more coupled?). Neither option is great. :(

FilterMode="FilterMode.SimpleWithMenu"
FilterOperator="FilterOperator.GreaterThanOrEquals">
<Template Context="p">
@(PaymentService.GetFundsReceived(Context, p.ProjectId).ToString("C0"))

@aharwood2 aharwood2 Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure on how "clean" putting a property on a model is where that value is only populated depending on where the model is used. Changing the approach from using LoadData to using built-in filtering means we do lose the flexibility the LoadData approach offers and have to do questionable design things like this. In some sense it is important to fix this feature but I'm not convinced this approach is the "correct" way to do it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove the actual property and maintain a dictionary on the page (mapping the ProjectId to the calculated funds amount) and reference that instead? This would remove it from the Project class, but feels even dirtier!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses the broken/crashing filtering behavior on the People and Manage Projects pages (issue #1366), likely triggered by changes in Radzen’s filtering behavior, by shifting filtering/sorting back toward Radzen’s built-in mechanisms and introducing grid-friendly derived properties.

Changes:

  • Adjust Radzen DataGrid filtering mode/config and align column FilterProperty/SortProperty with actual nested fields (e.g., School.Faculty.Code, LineManager.Name).
  • Introduce derived, non-persisted properties to support filtering in grids (Project.FundsReceived, Person.CurrentGrade).
  • Remove/reshape custom filtering logic in the page code-behind to reduce filter crashes and improve paging/counting behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
PPMTool/Pages/Projects.razor.cs Populates FundsReceived for grid filtering; removes custom Faculty/School filtering block.
PPMTool/Pages/Projects.razor Updates grid/column filter modes and adds typed/date/numeric filter configuration; switches to filtering on nested School/Faculty properties.
PPMTool/Pages/People.razor.cs Simplifies custom filtering to SkillTags only; relies on Radzen’s args.Filter for other filters; updates sorting/paging/count flow.
PPMTool/Pages/People.razor Updates Line Manager column to filter/sort by LineManager.Name; disables filtering on problematic derived columns; switches grade display to CurrentGrade.
PPMTool.Data/Entities/Project.cs Adds [NotMapped] FundsReceived to support grid filtering.
PPMTool.Data/Entities/Person.cs Adds [NotMapped] CurrentGrade to support grid filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PPMTool/Pages/Projects.razor Outdated
Comment on lines +130 to +134
// Add details of FundsReceived so we can use it for filtering in the grid as a property
foreach (Project p in query)
{
p.FundsReceived = PaymentService.GetFundsReceived(Context, p.ProjectId);
}
Comment on lines +133 to 137
// ---- BUILT-IN RADZEN FILTERING ----
if (!string.IsNullOrWhiteSpace(args.Filter))
{
// Check details of the sort
if (args.Sorts is { } sorts && sorts.Any())
{
var sort = args.Sorts?.First();
if (sort.Property == "SkillsCount")
{
// Apply the ordering process on skills count manually
if (sort.SortOrder == SortOrder.Ascending)
{
query = query.OrderBy(x => TagService.GetCountForPerson(Context, x.PersonId));
}
else
{
query = query.OrderByDescending(x => TagService.GetCountForPerson(Context, x.PersonId));
}
}
else if (sort.Property == "LineManager")
{
query = sort.SortOrder == SortOrder.Ascending ?
query.OrderBy(x => x.LineManager != null ? x.LineManager.Name : "") :
query.OrderByDescending(x => x.LineManager != null ? x.LineManager.Name : "");
}

// No special handling required
else
{
// Sort via the OrderBy method
query = query.OrderBy(args.OrderBy);
}
}
query = query.Where(args.Filter);
}
Comment thread PPMTool.Data/Entities/Project.cs
@aharwood2 aharwood2 modified the milestones: v1.14.0.1, v1.14.1 Jun 15, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtering on some pages broken

4 participants