Don't add non-existent items when resolving lists
When a task/story is deleted, the WorklistItem for that task/story is not deleted. Currently, this raises an exception when resolving the items of the worklists containing that task/story. This patch fixes that by skipping WorklistItems whose items no longer exist. In the long run, we should just not delete tasks/stories and archive them instead. Change-Id: I238bc4b86b5358fd11080be6ebfd9b76b09753f4
This commit is contained in:
parent
2b2e752f88
commit
cbe35d606a
@ -541,9 +541,13 @@ class Worklist(base.APIBase):
|
||||
item_model = WorklistItem.from_db_model(item)
|
||||
if item.item_type == 'story':
|
||||
story = stories_api.story_get(item.item_id)
|
||||
if story is None:
|
||||
continue
|
||||
item_model.story = Story.from_db_model(story)
|
||||
elif item.item_type == 'task':
|
||||
task = tasks_api.task_get(item.item_id)
|
||||
if task is None or task.story is None:
|
||||
continue
|
||||
item_model.task = Task.from_db_model(task)
|
||||
self.items.append(item_model)
|
||||
self.items.sort(key=lambda x: x.list_position)
|
||||
|
Loading…
x
Reference in New Issue
Block a user