From 0fa54639066889f492ff9b2278335edb6ab8d988 Mon Sep 17 00:00:00 2001 From: Grigory Statsenko Date: Wed, 8 Nov 2023 10:24:57 +0100 Subject: [PATCH] Fixed sorting in window function examples (#73) --- .../dl_formula_ref/categories/window.py | 1 - .../dl_formula_ref/functions/window.py | 22 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/dl_formula_ref/dl_formula_ref/categories/window.py b/lib/dl_formula_ref/dl_formula_ref/categories/window.py index 6c46f5391..a4a2e0721 100644 --- a/lib/dl_formula_ref/dl_formula_ref/categories/window.py +++ b/lib/dl_formula_ref/dl_formula_ref/categories/window.py @@ -1,6 +1,5 @@ from dl_formula_ref.localization import get_gettext from dl_formula_ref.registry.aliased_res import ( - AliasedLinkResource, AliasedTableResource, AliasedTextResource, SimpleAliasedResourceRegistry, diff --git a/lib/dl_formula_ref/dl_formula_ref/functions/window.py b/lib/dl_formula_ref/dl_formula_ref/functions/window.py index b03a19d72..34ecce3a4 100644 --- a/lib/dl_formula_ref/dl_formula_ref/functions/window.py +++ b/lib/dl_formula_ref/dl_formula_ref/functions/window.py @@ -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( @@ -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=[ @@ -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=[ @@ -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])"), ], ), ), @@ -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=[