Skip to content

Commit

Permalink
Merge pull request #52 from DSD-DBS/fix-delete-work-items
Browse files Browse the repository at this point in the history
fix: delete workitems via status
  • Loading branch information
micha91 authored Oct 29, 2024
2 parents 78d7529 + 75c149c commit aa4baa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion polarion_rest_api_client/clients/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ class StatusItemClient(UpdatableItemsClient, t.Generic[ST], abc.ABC):
them. This status has to be provided on initialization.
"""

item_cls: type[ST]

def __init__(
self,
project_id: str,
Expand All @@ -266,6 +268,10 @@ def delete(self, items: ST | list[ST]):
else:
if not isinstance(items, list):
items = [items]
delete_items: list[ST] = []
for item in items:
item.status = self.delete_status
self.update(items)
delete_items.append(
self.item_cls(id=item.id, status=self.delete_status)
)
self.update(delete_items)
1 change: 1 addition & 0 deletions polarion_rest_api_client/clients/work_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(
project_id, client
)
self.links = work_item_links.WorkItemLinks(project_id, client)
self.item_cls = dm.WorkItem

def _update(self, to_update: list[dm.WorkItem] | dm.WorkItem):
assert not isinstance(to_update, list), "Expected only one item"
Expand Down

0 comments on commit aa4baa1

Please sign in to comment.