[Notes] Fix "Between" date filter and user search#1945
Open
wwidergoldpimcore wants to merge 1 commit into
Open
[Notes] Fix "Between" date filter and user search#1945wwidergoldpimcore wants to merge 1 commit into
wwidergoldpimcore wants to merge 1 commit into
Conversation
Note field filters are translated to SQL in FilterService::applyFieldFilters. Two bugs made filtering return wrong results: - The bind parameter name was derived from the field name, so two conditions on the same field collided. A date "Between" range is sent by the UI as two conditions (`gt` from + `lt` to) on `date`, so the second value overwrote the first and the query collapsed to `date > to AND date < to` -> always empty. Fixed #1923. - The user column is exposed as `userName` in the Note schema and the UI filters on it, but the backend only special-cased `user`, so `userName` produced a condition against a non-existent column -> 500. The `user` branch also lacked a `continue`, emitting a spurious generic column condition. Fixed #1925. Bind parameters are now indexed per filter, and the user-name search is resolved via a subquery against `users`.`name` for the `userName` field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Not up to standards ⛔
|
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.



Changes in this pull request
Resolves #1923
Resolves #1925
Both bugs live in
Note/Service/FilterService::applyFieldFilters, which translates note field filters into SQL:[Notes] "Between" Date Filter operator doesn't work #1923 — "Between" date filter returns empty. The bind parameter name was derived from the field name, so two conditions on the same field collided. The UI decomposes a date "Between" range into two conditions (
gtfrom +ltto) ondate; the second:datebinding overwrote the first, collapsing the query todate > to AND date < to→ always empty. Bind parameters are now indexed per filter (:filter_0,:filter_1,:minTime_0/:maxTime_0), so the range resolves todate > from AND date < to.[Notes] Searching for user does not work #1925 — user search fails. The user column is exposed as
userNamein theNoteschema and the UI filters on it, but the backend only special-caseduser, souserNamegenerated a condition against a non-existent column → 500. Theuserbranch also lacked acontinue, emitting a spurious generic column condition on top of the subquery. TheuserNamefield is now resolved via a subquery againstusers.nameand short-circuits the generic condition.Additional info
userName, matching the schema property) — no UI change required. The previously-handleduserfield name is dropped (it was broken and unused by the UI).FilterServiceTestfor the "Between" range and theuserNamesearch; verified they fail without the fix. Full unit suite passes (444 tests), PHPStan clean.