Fix order by Text (#3957)

Mistake in the definition.
This commit is contained in:
James Dunkerley 2022-12-07 19:16:32 +00:00 committed by GitHub
parent 8f30fcf376
commit da0dc253cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -410,7 +410,7 @@ prepare_order_by : Vector -> Text | Vector Text | Sort_Column_Selector -> Proble
prepare_order_by internal_columns column_selectors problem_builder =
selected_elements = case column_selectors of
_ : Text ->
unified_name_selectors = [Sort_Column.Name unified_name_selectors]
unified_name_selectors = [Sort_Column.Name column_selectors]
select_columns_by_name internal_columns unified_name_selectors Text_Matcher.Case_Sensitive problem_builder name_extractor=(_.name)
_ : Vector ->
unified_name_selectors = column_selectors.map (Sort_Column.Name _)

View File

@ -35,6 +35,11 @@ spec setup =
t1.at "alpha" . to_vector . should_equal [0, 1, 2, 3]
t1.at "gamma" . to_vector . should_equal [4, 3, 2, 1]
Test.specify "should work with single column name" <|
t1 = table.order_by "alpha"
t1.at "alpha" . to_vector . should_equal [0, 1, 2, 3]
t1.at "gamma" . to_vector . should_equal [4, 3, 2, 1]
t2 = table.order_by (Sort_Column_Selector.By_Index [1, Sort_Column.Index -8 Sort_Direction.Descending])
t2.at "beta" . to_vector . should_equal ["a", "a", "b", "b"]
t2.at "gamma" . to_vector . should_equal [3, 1, 4, 2]