mirror of
https://github.com/logos-co/open-law.git
synced 2025-01-13 16:24:53 +00:00
removed useless code
This commit is contained in:
parent
a6a5810f80
commit
ad58816bcc
@ -81,3 +81,22 @@ def book_validator() -> Response | None:
|
|||||||
sub_collection_id=sub_collection_id,
|
sub_collection_id=sub_collection_id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
interpretation_id = request_args.get("interpretation_id")
|
||||||
|
if interpretation_id:
|
||||||
|
interpretation: m.Interpretation = db.session.get(
|
||||||
|
m.Interpretation, interpretation_id
|
||||||
|
)
|
||||||
|
if not interpretation or interpretation.is_deleted:
|
||||||
|
log(log.WARNING, "Interpretation with id [%s] not found", interpretation_id)
|
||||||
|
flash("Interpretation not found", "danger")
|
||||||
|
return redirect(
|
||||||
|
url_for(
|
||||||
|
"book.qa_view",
|
||||||
|
book_id=book_id,
|
||||||
|
collection_id=collection_id,
|
||||||
|
sub_collection_id=sub_collection_id,
|
||||||
|
section_id=section_id,
|
||||||
|
interpretation_id=interpretation_id,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -664,10 +664,6 @@ def section_edit(
|
|||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
)
|
)
|
||||||
section: m.Section = db.session.get(m.Section, section_id)
|
section: m.Section = db.session.get(m.Section, section_id)
|
||||||
if not section or section.is_deleted:
|
|
||||||
log(log.WARNING, "Section with id [%s] not found", section_id)
|
|
||||||
flash("Section not found", "danger")
|
|
||||||
return redirect(redirect_url)
|
|
||||||
|
|
||||||
form = f.EditSectionForm()
|
form = f.EditSectionForm()
|
||||||
|
|
||||||
@ -713,18 +709,7 @@ def section_delete(
|
|||||||
collection: m.Collection = db.session.get(
|
collection: m.Collection = db.session.get(
|
||||||
m.Collection, sub_collection_id or collection_id
|
m.Collection, sub_collection_id or collection_id
|
||||||
)
|
)
|
||||||
|
|
||||||
redirect_url = url_for(
|
|
||||||
"book.section_view",
|
|
||||||
book_id=book_id,
|
|
||||||
collection_id=collection_id,
|
|
||||||
sub_collection_id=sub_collection_id,
|
|
||||||
)
|
|
||||||
section: m.Section = db.session.get(m.Section, section_id)
|
section: m.Section = db.session.get(m.Section, section_id)
|
||||||
if not section or section.is_deleted:
|
|
||||||
log(log.WARNING, "Section with id [%s] not found", section_id)
|
|
||||||
flash("Section not found", "danger")
|
|
||||||
return redirect(redirect_url)
|
|
||||||
|
|
||||||
section.is_deleted = True
|
section.is_deleted = True
|
||||||
if not collection.active_sections:
|
if not collection.active_sections:
|
||||||
@ -769,7 +754,7 @@ def interpretation_create(
|
|||||||
sub_collection_id: int | None = None,
|
sub_collection_id: int | None = None,
|
||||||
):
|
):
|
||||||
section: m.Section = db.session.get(m.Section, section_id)
|
section: m.Section = db.session.get(m.Section, section_id)
|
||||||
|
form = f.CreateInterpretationForm()
|
||||||
redirect_url = url_for(
|
redirect_url = url_for(
|
||||||
"book.interpretation_view",
|
"book.interpretation_view",
|
||||||
book_id=book_id,
|
book_id=book_id,
|
||||||
@ -778,8 +763,6 @@ def interpretation_create(
|
|||||||
section_id=section.id,
|
section_id=section.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
form = f.CreateInterpretationForm()
|
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
interpretation: m.Interpretation = m.Interpretation(
|
interpretation: m.Interpretation = m.Interpretation(
|
||||||
label=form.label.data,
|
label=form.label.data,
|
||||||
@ -826,6 +809,10 @@ def interpretation_edit(
|
|||||||
interpretation_id: int,
|
interpretation_id: int,
|
||||||
sub_collection_id: int | None = None,
|
sub_collection_id: int | None = None,
|
||||||
):
|
):
|
||||||
|
interpretation: m.Interpretation = db.session.get(
|
||||||
|
m.Interpretation, interpretation_id
|
||||||
|
)
|
||||||
|
form = f.EditInterpretationForm()
|
||||||
redirect_url = url_for(
|
redirect_url = url_for(
|
||||||
"book.qa_view",
|
"book.qa_view",
|
||||||
book_id=book_id,
|
book_id=book_id,
|
||||||
@ -834,21 +821,6 @@ def interpretation_edit(
|
|||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
interpretation_id=interpretation_id,
|
interpretation_id=interpretation_id,
|
||||||
)
|
)
|
||||||
section: m.Section = db.session.get(m.Section, section_id)
|
|
||||||
if not section or section.is_deleted:
|
|
||||||
log(log.WARNING, "Section with id [%s] not found", section_id)
|
|
||||||
flash("Section not found", "danger")
|
|
||||||
return redirect(redirect_url)
|
|
||||||
|
|
||||||
interpretation: m.Interpretation = db.session.get(
|
|
||||||
m.Interpretation, interpretation_id
|
|
||||||
)
|
|
||||||
if not interpretation or interpretation.is_deleted:
|
|
||||||
log(log.WARNING, "Interpretation with id [%s] not found", interpretation_id)
|
|
||||||
flash("Interpretation not found", "danger")
|
|
||||||
return redirect(redirect_url)
|
|
||||||
|
|
||||||
form = f.EditInterpretationForm()
|
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
label = form.label.data
|
label = form.label.data
|
||||||
@ -891,26 +863,9 @@ def interpretation_delete(
|
|||||||
interpretation_id: int,
|
interpretation_id: int,
|
||||||
sub_collection_id: int | None = None,
|
sub_collection_id: int | None = None,
|
||||||
):
|
):
|
||||||
redirect_url = url_for(
|
|
||||||
"book.interpretation_view",
|
|
||||||
book_id=book_id,
|
|
||||||
collection_id=collection_id,
|
|
||||||
sub_collection_id=sub_collection_id,
|
|
||||||
section_id=section_id,
|
|
||||||
)
|
|
||||||
section: m.Section = db.session.get(m.Section, section_id)
|
|
||||||
if not section or section.is_deleted:
|
|
||||||
log(log.WARNING, "Section with id [%s] not found", section_id)
|
|
||||||
flash("Section not found", "danger")
|
|
||||||
return redirect(redirect_url)
|
|
||||||
|
|
||||||
interpretation: m.Interpretation = db.session.get(
|
interpretation: m.Interpretation = db.session.get(
|
||||||
m.Interpretation, interpretation_id
|
m.Interpretation, interpretation_id
|
||||||
)
|
)
|
||||||
if not interpretation or interpretation.is_deleted:
|
|
||||||
log(log.WARNING, "Interpretation with id [%s] not found", interpretation_id)
|
|
||||||
flash("Interpretation not found", "danger")
|
|
||||||
return redirect(redirect_url)
|
|
||||||
|
|
||||||
interpretation.is_deleted = True
|
interpretation.is_deleted = True
|
||||||
log(log.INFO, "Delete interpretation [%s]", interpretation)
|
log(log.INFO, "Delete interpretation [%s]", interpretation)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user