Skip to content

Commit

Permalink
get_events: use new EventNode-argument (assigned) everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
pboettch committed Dec 7, 2023
1 parent eb36cc6 commit e66777c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tscat_gui/tscat_driver/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def action(self) -> None:
assert isinstance(catalogue, _Catalogue)

# clean uuids of already existing events (assigned, not filtered)
existing_events_uuids = set(event.uuid for event in get_events(catalogue, assigned_only=True))
existing_events_uuids = set(event.uuid for event in get_events(catalogue, assigned_only=True)[0])
self.uuids = list(set(self.uuids) - existing_events_uuids)
add_events_to_catalogue(catalogue, list(map(self._event, self.uuids)))

Expand Down Expand Up @@ -239,7 +239,7 @@ class DeletePermanentlyAction(Action):
def action(self) -> None:
for entity in map(self._entity, self.uuids):
if isinstance(entity, _Catalogue):
linked_uuids = [e.uuid for e in get_events(entity, assigned_only=True)]
linked_uuids = [e.uuid for e in get_events(entity, assigned_only=True)[0]]
elif isinstance(entity, _Event):
linked_uuids = [e.uuid for e in get_catalogues(entity)]

Expand Down
11 changes: 5 additions & 6 deletions tscat_gui/tscat_driver/catalog_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ def __init__(self, root: CatalogNode):
def _driver_action_done(self, action: Action) -> None:
if isinstance(action, GetCatalogueAction):
if action.uuid == self._root.uuid:
children = [EventNode(e, i.assigned) for e, i in zip(action.events, action.query_info)]
if action.removed_items:
self._trash.set_children(list(map(EventNode, action.events)))
# unused for now
self._trash.set_children(children)
else:
self.beginResetModel()
children: List[EventNode] = []
for e, i in zip(action.events, action.query_info):
children.append(EventNode(e, i.assigned))
self._root.set_children(children)
self.endResetModel()

Expand All @@ -49,7 +48,7 @@ def _driver_action_done(self, action: Action) -> None:

elif isinstance(action, AddEventsToCatalogueAction):
if action.catalogue_uuid == self._root.uuid:
nodes = list(map(lambda x: EventNode(x), map(tscat_driver.event_from_uuid, action.uuids)))
nodes = list(map(lambda x: EventNode(x, True), map(tscat_driver.event_from_uuid, action.uuids)))

removed_nodes = list(filter(lambda x: x.node.is_removed(), nodes))
nodes = list(filter(lambda x: not x.node.is_removed(), nodes))
Expand All @@ -65,7 +64,7 @@ def _driver_action_done(self, action: Action) -> None:
nodes: List[EventNode] = [] # type: ignore
for e in action.deleted_entities:
if e.type == _Event:
event_node = EventNode(e.restored_entity)
event_node = EventNode(e.restored_entity, True)
if e.restored_entity.is_removed():
removed_nodes.append(event_node)
else:
Expand Down

0 comments on commit e66777c

Please sign in to comment.