fix BUG-25 by using ORM not db calls direct, could not see why they worked in DEV but not PROD with NO logs - only assume sqlachemy2 doesnt like the engine execute code I used instead
This commit is contained in:
2
BUGs
2
BUGs
@@ -1,6 +1,6 @@
|
|||||||
### fix to get this working with bs 5...
|
### fix to get this working with bs 5...
|
||||||
|
|
||||||
#### BUGS (next-25)
|
#### BUGS (next-26)
|
||||||
BUG-21: parent series now showing all books (thomas covenant series)
|
BUG-21: parent series now showing all books (thomas covenant series)
|
||||||
|
|
||||||
### DB/back-end
|
### DB/back-end
|
||||||
|
|||||||
16
main.py
16
main.py
@@ -774,13 +774,9 @@ def stats():
|
|||||||
def rem_books_from_loan(id):
|
def rem_books_from_loan(id):
|
||||||
for field in request.form:
|
for field in request.form:
|
||||||
rem_id=int(re.findall( '\d+', field )[0])
|
rem_id=int(re.findall( '\d+', field )[0])
|
||||||
try:
|
bll = Book_Loan_Link.query.filter(Book_Loan_Link.loan_id==id, Book_Loan_Link.book_id == rem_id ).one()
|
||||||
with db.engine.connect() as conn:
|
db.session.delete(bll)
|
||||||
conn.exec_driver_sql( "delete from book_loan_link where book_id = {} and loan_id = {}".format( rem_id, id ))
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except SQLAlchemyError as e:
|
|
||||||
st.SetAlert("danger")
|
|
||||||
st.SetMessage("Failed to remove books from loan! -- {}".format( e.orig ))
|
|
||||||
return jsonify(success=True)
|
return jsonify(success=True)
|
||||||
|
|
||||||
@app.route("/add_books_to_loan/<id>", methods=["POST"])
|
@app.route("/add_books_to_loan/<id>", methods=["POST"])
|
||||||
@@ -788,13 +784,9 @@ def rem_books_from_loan(id):
|
|||||||
def add_books_to_loan(id):
|
def add_books_to_loan(id):
|
||||||
for field in request.form:
|
for field in request.form:
|
||||||
add_id=int(re.findall( '\d+', field )[0])
|
add_id=int(re.findall( '\d+', field )[0])
|
||||||
try:
|
bll = Book_Loan_Link( loan_id=id, book_id=add_id )
|
||||||
with db.engine.connect() as conn:
|
db.session.add(bll)
|
||||||
conn.exec_driver_sql( "insert into book_loan_link (book_id, loan_id) values ( {}, {} )".format( add_id, id ))
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except SQLAlchemyError as e:
|
|
||||||
st.SetAlert("danger")
|
|
||||||
st.SetMessage("Failed to add books to loan! -- {}".format( e.orig ))
|
|
||||||
return jsonify(success=True)
|
return jsonify(success=True)
|
||||||
|
|
||||||
@app.route("/rem_parent_books_from_series/<pid>", methods=["POST"])
|
@app.route("/rem_parent_books_from_series/<pid>", methods=["POST"])
|
||||||
|
|||||||
Reference in New Issue
Block a user