mirror of https://github.com/logos-co/open-law.git
parrent > parent
This commit is contained in:
parent
ef428b16e2
commit
4d1e195fe8
|
@ -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():
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue