From f8d545ba11e1cd4ed046954e3978fa67e0f00c13 Mon Sep 17 00:00:00 2001 From: Ian Scott Date: Wed, 30 Oct 2024 07:40:08 -0400 Subject: [PATCH] fix(wip): Working on migration problems --- .../services/communities.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/invenio_record_importer_kcworks/services/communities.py b/invenio_record_importer_kcworks/services/communities.py index 9a48e39..0a78013 100644 --- a/invenio_record_importer_kcworks/services/communities.py +++ b/invenio_record_importer_kcworks/services/communities.py @@ -554,22 +554,21 @@ def add_record_to_group_collections( # if c["custom_fields"].get("kcr:commons_group_name") # == group_name # ] - app.logger.debug( - f"coll_record: {pformat(coll_search.to_dict())}" - ) + app.logger.debug(f"coll_record: {pformat(coll_search)}") try: assert len(coll_records) == 1 except AssertionError: app.logger.debug(pformat(metadata_record)) - if ( - len(coll_records) > 1 - and metadata_record["is_published"] is False - and metadata_record["status"] != "published" - ): + if len(coll_records) > 1: raise MultipleActiveCollectionsError( f" multiple active collections found " f"for {group_id}" ) + else: + raise CollectionNotFoundError( + f" no active collections found for " + f'"{group_id}"' + ) coll_record = coll_records[0] app.logger.debug( f" found group collection {coll_record['id']}"