Skip to content
Snippets Groups Projects
Unverified Commit 096b4968 authored by John Swanson's avatar John Swanson Committed by GitHub
Browse files

Query ref validation: fix non-deterministic sort (#47449)

... and the associated flaky test!
parent 30b08dd1
No related branches found
No related tags found
No related merge requests found
......@@ -49,13 +49,19 @@
[[:not= nil [:max :coll.name]] :is_child_collection]]
"created_by" [:u.first_name :u.last_name :u.email]
"last_edited_at" [:c.updated_at])
order-by-clause (condp = sort-column
"collection" [[:is_child_collection sort-dir-kw]
[[:max :coll.name] sort-dir-kw]]
"created_by" [[[:coalesce [:|| :u.first_name " " :u.last_name]
:u.first_name :u.last_name :u.email]
sort-dir-kw]]
[(into sorting-selects [sort-dir-kw])])
order-by-clause (concat
(condp = sort-column
"collection" [[:is_child_collection sort-dir-kw]
[[:max :coll.name] sort-dir-kw]]
"created_by" [[[:coalesce [:|| :u.first_name " " :u.last_name]
:u.first_name :u.last_name :u.email]
sort-dir-kw]]
[(into sorting-selects [sort-dir-kw])])
;; fallbacks to ensure deterministic sorting:
;; - sort by card name,
;; - if even that's the same, sort by the ID
[[:c.name sort-dir-kw]
[:c.id sort-dir-kw]])
card-query (query-analysis/cards-with-reference-errors
(m/assoc-some
;; TODO this table has a lot of fields... we should whittle down to only the ones we need.
......
......@@ -240,8 +240,8 @@
:data
[{:id card-3}
{:id card-2}
{:id card-1}
{:id card-5}]}
{:id card-5}
{:id card-1}]}
(-> (get! {:sort_column "collection" :sort_direction "desc"})
(select-keys [:total :data])
(with-data-keys [:id]))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment