fix: remove duplicates from vobj.children
This commit is contained in:
@@ -8,13 +8,14 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Support `unique=False` in `vgroups` filter to return a list of all entries (including duplicates)
|
- `vgroups` filter now supports `unique=False` to return a list of all entries including duplicates (default: `True`)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- No duplicate `GroupBySource` entries in `vgroups` filter (while keeping sort order)
|
- Preserves original sort order in `vgroups` filter if `unique=True`
|
||||||
|
- Remove duplicates from `GroupBySource` children
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Change default `recursive=True` for `vgroups` filter (most probable use case)
|
- `vgroups` filter uses `recursive=True` by default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ class VGroups:
|
|||||||
*,
|
*,
|
||||||
fields: Union[str, Iterable[str], None] = None,
|
fields: Union[str, Iterable[str], None] = None,
|
||||||
flows: Union[str, Iterable[str], None] = None,
|
flows: Union[str, Iterable[str], None] = None,
|
||||||
|
order_by: Union[str, Iterable[str], None] = None,
|
||||||
recursive: bool = True,
|
recursive: bool = True,
|
||||||
unique: bool = True,
|
unique: bool = True,
|
||||||
order_by: Union[str, Iterable[str], None] = None,
|
|
||||||
) -> Iterator['GroupBySource']:
|
) -> Iterator['GroupBySource']:
|
||||||
''' Extract all referencing groupby virtual objects from a page. '''
|
''' Extract all referencing groupby virtual objects from a page. '''
|
||||||
# prepare filter
|
# prepare filter
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class GroupBySource(VirtualSourceObject):
|
|||||||
self.page_num = page_num
|
self.page_num = page_num
|
||||||
|
|
||||||
def append_child(self, child: 'Record', key_obj: Any) -> None:
|
def append_child(self, child: 'Record', key_obj: Any) -> None:
|
||||||
if child not in self.__children:
|
if child.path not in self.__children:
|
||||||
self.__children.append(child.path)
|
self.__children.append(child.path)
|
||||||
# __key_obj_map is later used to find most used key_obj
|
# __key_obj_map is later used to find most used key_obj
|
||||||
self.__key_obj_map.append(key_obj)
|
self.__key_obj_map.append(key_obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user