Skip to content

Commit

Permalink
handle archived kills
Browse files Browse the repository at this point in the history
  • Loading branch information
marwoodandrew committed Dec 27, 2023
1 parent d46cbd6 commit 883d8a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions server/aap/publish/transmitters/http_push_apple_news.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ def _get_item(self, queue_item):
)

def _get_original_guid(self, item):
"""
Chase up the rewrite list until we get to the orignal in either the archive or legal archive (if the item has
expired from production
:param item:
:return:
"""
guid = item.get('rewrite_of', item.get('guid', item.get('item_id', None)))
for i in range(item.get('rewrite_sequence', 1)):
prev = get_resource_service('archive').find_one(
req=None, _id=guid
)
for _i in range(item.get('rewrite_sequence', 1)):
prev = get_resource_service('archive').find_one(req=None, _id=guid)
if not prev:
prev = get_resource_service('legal_archive').find_one(req=None, _id=guid)
if not prev or not prev.get('rewrite_of'):
break
guid = prev['rewrite_of']
Expand Down

0 comments on commit 883d8a3

Please sign in to comment.