diff --git a/app/views/book.py b/app/views/book.py index 3dcdace..5edb824 100644 --- a/app/views/book.py +++ b/app/views/book.py @@ -381,10 +381,10 @@ def collection_create(book_id: int, collection_id: int | None = None): label=label, ) if collection_id: - collection = collection.filter_by(parrent_id=collection_id) + collection = collection.filter_by(parent_id=collection_id) else: collection = collection.filter_by( - parrent_id=book.versions[-1].root_collection.id + parent_id=book.versions[-1].root_collection.id ) collection = collection.first() @@ -402,10 +402,10 @@ def collection_create(book_id: int, collection_id: int | None = None): collection: m.Collection = m.Collection( label=label, about=form.about.data, - parrent_id=book.versions[-1].root_collection.id, + parent_id=book.versions[-1].root_collection.id, ) if collection_id: - collection.parrent_id = collection_id + collection.parent_id = collection_id collection.is_leaf = True log(log.INFO, "Create collection [%s]. Book: [%s]", collection, book.id) @@ -475,10 +475,10 @@ def collection_edit( ).filter(m.Collection.id != collection_to_edit.id) if sub_collection_id: - collection_query = collection_query.filter_by(parrent_id=collection_id) + collection_query = collection_query.filter_by(parent_id=collection_id) else: collection_query = collection_query.filter_by( - parrent_id=collection_to_edit.parrent.id + parent_id=collection_to_edit.parent.id ) if collection_query.first(): diff --git a/tests/test_book.py b/tests/test_book.py index 3b142cb..c4faff9 100644 --- a/tests/test_book.py +++ b/tests/test_book.py @@ -221,7 +221,7 @@ def test_crud_collection(client: FlaskClient, runner: FlaskCliRunner): m.Collection( label="Test Collection #2 Label", version_id=collection.version_id, - parrent_id=collection.parrent_id, + parent_id=collection.parent_id, ).save() response: Response = client.post( @@ -302,7 +302,7 @@ def test_crud_subcollection(client: FlaskClient, runner: FlaskCliRunner): label="Test Leaf Collection #1 Label", version_id=book.versions[-1].id, is_leaf=True, - parrent_id=book.versions[-1].root_collection.id, + parent_id=book.versions[-1].root_collection.id, ).save() collection: m.Collection = m.Collection( label="Test Collection #1 Label", version_id=book.versions[-1].id @@ -346,12 +346,12 @@ def test_crud_subcollection(client: FlaskClient, runner: FlaskCliRunner): ).first() assert sub_collection assert sub_collection.is_leaf - assert sub_collection.parrent_id == collection.id + assert sub_collection.parent_id == collection.id m.Collection( label="Test SubCollection #2 Label", version_id=collection.version_id, - parrent_id=collection.id, + parent_id=collection.id, ).save() response: Response = client.post(