fix(lookup): partition dedup by name instead of group
ROW_NUMBER() was partitioning by `group`, collapsing all 12 US/* timezones (which share group="United States") down to a single record. Partitioning by `name` correctly deduplicates by timezone identity while still preserving the object > account > global override hierarchy. Priority-only list now returns the expected 72 entries. Adds a regression test asserting all 12 US/* timezones are present in the full list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,8 +28,8 @@ def get_lookup_list_v3(
|
||||
SELECT * FROM (
|
||||
SELECT *,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY `group`
|
||||
ORDER BY
|
||||
PARTITION BY `name`
|
||||
ORDER BY
|
||||
(for_type = :for_type AND for_id = :for_id) DESC,
|
||||
(account_id = :account_id) DESC,
|
||||
created_on DESC
|
||||
|
||||
Reference in New Issue
Block a user