fix federated status update

This commit is contained in:
Her Email 2023-11-18 20:30:48 -05:00 committed by Henri Dickson
parent fad290e91d
commit 614918965c
3 changed files with 11 additions and 11 deletions

View file

@ -48,7 +48,7 @@ class EditionInSchema(ItemInSchema):
pub_month: int | None = None
binding: str | None = None
price: str | None = None
pages: str | None = None
pages: int | str | None = None
series: str | None = None
imprint: str | None = None

@ -1 +1 @@
Subproject commit 4b434ff4a53d162e4caca0880d9827289ccac0f3
Subproject commit c1f202a958b0c90a605042d9157f7dc246a5ac9a

View file

@ -32,18 +32,22 @@ _supported_ap_journal_types = {
def _parse_item_links(objects):
logger.debug(f"Parsing item links from {objects}")
if not objects:
return []
objs = objects if isinstance(objects, list) else [objects]
items = [
obj["href"]
for obj in objects
if obj["type"] in _supported_ap_catalog_item_types
obj["href"] for obj in objs if obj["type"] in _supported_ap_catalog_item_types
]
return items
def _parse_piece_objects(objects):
logger.debug(f"Parsing pieces from {objects}")
if not objects:
return []
objs = objects if isinstance(objects, list) else [objects]
pieces = []
for obj in objects:
for obj in objs:
if obj["type"] in _supported_ap_journal_types.keys():
pieces.append(obj)
else:
@ -96,11 +100,7 @@ def _update_or_create_post(pk, obj):
cls.update_by_ap_object(owner, item, p, pk, _get_visibility(post.visibility))
def post_created(pk, obj):
_update_or_create_post(pk, obj)
def post_updated(pk, obj):
def post_fetched(pk, obj):
_update_or_create_post(pk, obj)