[Listing] Fix date filter "Between" and Unix-timestamp columns#1946
Open
wwidergoldpimcore wants to merge 1 commit into
Open
[Listing] Fix date filter "Between" and Unix-timestamp columns#1946wwidergoldpimcore wants to merge 1 commit into
wwidergoldpimcore wants to merge 1 commit into
Conversation
…#1937) The shared Listing/Filter/DateFilter is used by the notifications and recycle-bin listings (among others). Two bugs made date filtering return wrong results: - The bind parameter name was derived from the column key, so two conditions on the same column collided. The UI sends a "Between" range as two conditions (`from` + `to`) on the same key, so the second value overwrote the first and the query collapsed to `col >= to AND col <= to` -> always empty. Bind parameters are now indexed per applied filter. Fixed #1924 (and the "Between" case for recycle bin in #1937). - The filter always compared against a Carbon datetime string, but the recycle-bin `date` column stores a Unix timestamp (int). MySQL coerced the string to a number, so every operator (including "On") returned an empty list. Columns that store a Unix timestamp are now compared against an integer timestamp. Fixed #1937. 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 #1924
Resolves #1937
Both bugs live in the shared
Listing/Filter/DateFilter, used by the notifications, recycle-bin (and other) listings.[Notifications] "Between" Date Filter operator doesn't work #1924 — Notifications "Between" returns empty. The bind parameter name was derived from the column key, so two conditions on the same column collided. The UI sends a "Between" range as two
columnFilters(from+to) on the same key (creationDate); both bound to:creationDate, the second overwrote the first, and the query collapsed tocreationDate >= to AND creationDate <= to→ always empty. This is the same class as [Notes] "Between" Date Filter operator doesn't work #1923. Bind parameters are now indexed per applied filter (:filter_0/:filter_1,:minTime_0/:maxTime_0).[Recycle Bin] Date Filter operators don't work #1937 — Recycle bin date filters don't work (all operators). In addition to the collision above, the filter always compared against a Carbon datetime string (
'2024-06-10 00:00:00'), butrecyclebin.dateis anint(11) unsignedUnix timestamp. MySQL coerced the string to a number, so even "On" returned an empty list. Columns that store a Unix timestamp are now compared against an integer timestamp.Why a class-keyed map for the timestamp columns
The generic
DateFilterhas no reliable way to learn a column's storage type: the frontend sends a genericdatetype, listings expose no table-name accessor (the recycle-bin Dao hardcodesFROM recyclebinin raw SQL), and per-request schema introspection would be heavy and fragile. The storage format is a fixed, domain-specific fact, so it's encoded explicitly asUNIX_TIMESTAMP_COLUMNS(listing class → column keys). Notifications (creationDateis aTIMESTAMP) keeps the datetime-string path and is unaffected.Additional info
DateFilterTestfor the "Between" collision and the Unix-timestamp column; verified they fail without the fix. Full unit suite passes (446 tests), PHPStan clean.TODOreferencing [Recycle Bin] Date Filter operators don't work #1937 (recycle-bin/filters/filters.tsx). It should be re-enabled once this lands.FilterService), which is a different filter implementation.