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,
|
label=label,
|
||||||
)
|
)
|
||||||
if collection_id:
|
if collection_id:
|
||||||
collection = collection.filter_by(parrent_id=collection_id)
|
collection = collection.filter_by(parent_id=collection_id)
|
||||||
else:
|
else:
|
||||||
collection = collection.filter_by(
|
collection = collection.filter_by(
|
||||||
parrent_id=book.versions[-1].root_collection.id
|
parent_id=book.versions[-1].root_collection.id
|
||||||
)
|
)
|
||||||
collection = collection.first()
|
collection = collection.first()
|
||||||
|
|
||||||
|
@ -402,10 +402,10 @@ def collection_create(book_id: int, collection_id: int | None = None):
|
||||||
collection: m.Collection = m.Collection(
|
collection: m.Collection = m.Collection(
|
||||||
label=label,
|
label=label,
|
||||||
about=form.about.data,
|
about=form.about.data,
|
||||||
parrent_id=book.versions[-1].root_collection.id,
|
parent_id=book.versions[-1].root_collection.id,
|
||||||
)
|
)
|
||||||
if collection_id:
|
if collection_id:
|
||||||
collection.parrent_id = collection_id
|
collection.parent_id = collection_id
|
||||||
collection.is_leaf = True
|
collection.is_leaf = True
|
||||||
|
|
||||||
log(log.INFO, "Create collection [%s]. Book: [%s]", collection, book.id)
|
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)
|
).filter(m.Collection.id != collection_to_edit.id)
|
||||||
|
|
||||||
if sub_collection_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:
|
else:
|
||||||
collection_query = collection_query.filter_by(
|
collection_query = collection_query.filter_by(
|
||||||
parrent_id=collection_to_edit.parrent.id
|
parent_id=collection_to_edit.parent.id
|
||||||
)
|
)
|
||||||
|
|
||||||
if collection_query.first():
|
if collection_query.first():
|
||||||
|
|
|
@ -221,7 +221,7 @@ def test_crud_collection(client: FlaskClient, runner: FlaskCliRunner):
|
||||||
m.Collection(
|
m.Collection(
|
||||||
label="Test Collection #2 Label",
|
label="Test Collection #2 Label",
|
||||||
version_id=collection.version_id,
|
version_id=collection.version_id,
|
||||||
parrent_id=collection.parrent_id,
|
parent_id=collection.parent_id,
|
||||||
).save()
|
).save()
|
||||||
|
|
||||||
response: Response = client.post(
|
response: Response = client.post(
|
||||||
|
@ -302,7 +302,7 @@ def test_crud_subcollection(client: FlaskClient, runner: FlaskCliRunner):
|
||||||
label="Test Leaf Collection #1 Label",
|
label="Test Leaf Collection #1 Label",
|
||||||
version_id=book.versions[-1].id,
|
version_id=book.versions[-1].id,
|
||||||
is_leaf=True,
|
is_leaf=True,
|
||||||
parrent_id=book.versions[-1].root_collection.id,
|
parent_id=book.versions[-1].root_collection.id,
|
||||||
).save()
|
).save()
|
||||||
collection: m.Collection = m.Collection(
|
collection: m.Collection = m.Collection(
|
||||||
label="Test Collection #1 Label", version_id=book.versions[-1].id
|
label="Test Collection #1 Label", version_id=book.versions[-1].id
|
||||||
|
@ -346,12 +346,12 @@ def test_crud_subcollection(client: FlaskClient, runner: FlaskCliRunner):
|
||||||
).first()
|
).first()
|
||||||
assert sub_collection
|
assert sub_collection
|
||||||
assert sub_collection.is_leaf
|
assert sub_collection.is_leaf
|
||||||
assert sub_collection.parrent_id == collection.id
|
assert sub_collection.parent_id == collection.id
|
||||||
|
|
||||||
m.Collection(
|
m.Collection(
|
||||||
label="Test SubCollection #2 Label",
|
label="Test SubCollection #2 Label",
|
||||||
version_id=collection.version_id,
|
version_id=collection.version_id,
|
||||||
parrent_id=collection.id,
|
parent_id=collection.id,
|
||||||
).save()
|
).save()
|
||||||
|
|
||||||
response: Response = client.post(
|
response: Response = client.post(
|
||||||
|
|
Loading…
Reference in New Issue