Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix federated status update #380

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalog/book/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion neodb-takahe
18 changes: 9 additions & 9 deletions takahe/ap_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,22 @@

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:
Expand Down Expand Up @@ -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)


Expand Down