(session: SessionDep, current_user: CurrentUser, tree: any, ds: CoreDatasource)
| 25 | |
| 26 | |
| 27 | def transTreeToWhere(session: SessionDep, current_user: CurrentUser, tree: any, ds: CoreDatasource) -> str | None: |
| 28 | if tree is None: |
| 29 | return None |
| 30 | logic = tree['logic'] |
| 31 | |
| 32 | items = tree['items'] |
| 33 | list: List[str] = [] |
| 34 | if items is not None: |
| 35 | for item in items: |
| 36 | exp: str = None |
| 37 | if item['type'] == 'item': |
| 38 | exp = transTreeItem(session, current_user, item, ds) |
| 39 | elif item['type'] == 'tree': |
| 40 | exp = transTreeToWhere(session, current_user, item['sub_tree'], ds) |
| 41 | |
| 42 | if exp is not None: |
| 43 | list.append(exp) |
| 44 | return '(' + f' {logic} '.join(list) + ')' if len(list) > 0 else None |
| 45 | |
| 46 | |
| 47 | def transTreeItem(session: SessionDep, current_user: CurrentUser, item: Dict, ds: CoreDatasource) -> str | None: |
no test coverage detected