Skip to content

[Notes] Fix "Between" date filter and user search#1945

Open
wwidergoldpimcore wants to merge 1 commit into
2026.2from
bugfix/notes-field-filters-1923-1925
Open

[Notes] Fix "Between" date filter and user search#1945
wwidergoldpimcore wants to merge 1 commit into
2026.2from
bugfix/notes-field-filters-1923-1925

Conversation

@wwidergoldpimcore

Copy link
Copy Markdown
Contributor

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 (gt from + lt to) on date; the second :date binding overwrote the first, collapsing the query to date > 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 to date > from AND date < to.

  • [Notes] Searching for user does not work #1925 — user search fails. 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 generated a condition against a non-existent column → 500. The user branch also lacked a continue, emitting a spurious generic column condition on top of the subquery. The userName field is now resolved via a subquery against users.name and short-circuits the generic condition.

Additional info

  • Aligned the backend to the field name the Studio UI actually sends (userName, matching the schema property) — no UI change required. The previously-handled user field name is dropped (it was broken and unused by the UI).
  • Regression tests added/updated in FilterServiceTest for the "Between" range and the userName search; verified they fail without the fix. Full unit suite passes (444 tests), PHPStan clean.

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>
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@wwidergoldpimcore wwidergoldpimcore self-assigned this Jul 9, 2026
@wwidergoldpimcore wwidergoldpimcore added this to the 2026.2.1 milestone Jul 9, 2026
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant