Skip to content

Commit

Permalink
Fixed sorting in window function examples (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
altvod authored Nov 8, 2023
1 parent 31b3f58 commit 0fa5463
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion lib/dl_formula_ref/dl_formula_ref/categories/window.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dl_formula_ref.localization import get_gettext
from dl_formula_ref.registry.aliased_res import (
AliasedLinkResource,
AliasedTableResource,
AliasedTextResource,
SimpleAliasedResourceRegistry,
Expand Down
22 changes: 11 additions & 11 deletions lib/dl_formula_ref/dl_formula_ref/functions/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def _make_simple_order_by_examples(func: str) -> List[DataExample]:
]


def _make_rfunc_examples(func: str) -> List[DataExample]:
def _make_rfunc_examples(func: str) -> list[DataExample]:
func = func.upper()
examples = [
DataExample(
Expand All @@ -411,9 +411,9 @@ def _make_rfunc_examples(func: str) -> List[DataExample]:
[
("City", "[City]"),
("Order Sum", "[Order Sum]"),
(f"{func} 1", f'{func}([Order Sum], "desc")'),
(f"{func} 1", f'{func}([Order Sum], "desc" ORDER BY [City])'),
(f"{func} 2", f'{func}([Order Sum], "asc" ORDER BY [City] DESC)'),
(f"{func} 3", f"{func}([Order Sum] ORDER BY [Order Sum])"),
(f"{func} 3", f"{func}([Order Sum] ORDER BY [Order Sum], [City])"),
],
],
override_formula_fields=[
Expand Down Expand Up @@ -571,9 +571,9 @@ def _make_mfunc_examples(func: str) -> List[DataExample]:
[
("City", "[City]"),
("Order Sum", "[Order Sum]"),
(f"{func} 1", f"{func}([Order Sum], 1)"),
(f"{func} 2", f"{func}([Order Sum], -2)"),
(f"{func} 3", f"{func}([Order Sum], 1, 1)"),
(f"{func} 1", f"{func}([Order Sum], 1 ORDER BY [City])"),
(f"{func} 2", f"{func}([Order Sum], -2 ORDER BY [City])"),
(f"{func} 3", f"{func}([Order Sum], 1, 1 ORDER BY [City])"),
],
],
override_formula_fields=[
Expand Down Expand Up @@ -631,9 +631,9 @@ def _make_mfunc_examples(func: str) -> List[DataExample]:
("City", "[City]"),
("Category", "[Category]"),
("Order Sum", "SUM([Orders])"),
(f"{func} 1", f"{func}(SUM([Orders]), 1 TOTAL)"),
(f"{func} 2", f"{func}(SUM([Orders]), 1 WITHIN [City])"),
(f"{func} 3", f"{func}(SUM([Orders]), 1 AMONG [City])"),
(f"{func} 1", f"{func}(SUM([Orders]), 1 TOTAL ORDER BY [City])"),
(f"{func} 2", f"{func}(SUM([Orders]), 1 WITHIN [City] ORDER BY [City])"),
(f"{func} 3", f"{func}(SUM([Orders]), 1 AMONG [City] ORDER BY [City])"),
],
),
),
Expand Down Expand Up @@ -775,8 +775,8 @@ def _make_lag_examples(func: str) -> List[DataExample]:
[
("City", "[City]"),
("Order Sum", "[Order Sum]"),
(f"{func} 1", f"{func}([Order Sum], 1)"),
(f"{func} 2", f"{func}([Order Sum], -2)"),
(f"{func} 1", f"{func}([Order Sum], 1 ORDER BY [City])"),
(f"{func} 2", f"{func}([Order Sum], -2 ORDER BY [City])"),
],
],
override_formula_fields=[
Expand Down

0 comments on commit 0fa5463

Please sign in to comment.