Fix broken filters - #167
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Correct the invalid MeterAssetGroup.ID references and preserve unlocated meters when no location filter is supplied.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes Event Search filtering for location, asset-group, disturbance, and fault queries.
Changes:
- Adds temporary meter and asset filter tables.
- Applies OR-based location and asset-group matching.
- Reapplies disturbance filters after rejoining results.
| File | Summary |
|---|---|
PQBrowser/Controllers/OpenXDAController.cs |
Updates event, disturbance, and fault filtering logic; contains a critical invalid-column issue and a moderate NULL-location filtering issue. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
elwills
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Logic was written like so...
But the correct logic should look more like this...
There are additional complications due to the possibility that there may not be any filter defined for location or asset group, but this is the basic idea.
As for disturbance filters, the filter query looks something like this...
The inner query ensures we get at least as many event IDs as we need to return at least 100 results. Because of the trick we use for the
ORDER BYclause, we must forget about the disturbances we joined into the inner query and rejoin them to the filtered event list. However, that means we need to apply all the same filters to the outer query as we did the inner query so we don't return results that were filtered out of the inner query. Therefore, the idea is to simply addWHERE <filters>to the end of the query.