delete unnecessary db.connect()
This commit is contained in:
parent
2eb19bc82c
commit
81051aa73a
|
@ -7,8 +7,6 @@ from models import EpicenterOrder, CancelReason, db
|
||||||
|
|
||||||
def get_cancel_reason_name(reason_ukr: str):
|
def get_cancel_reason_name(reason_ukr: str):
|
||||||
try:
|
try:
|
||||||
# Connect to the database
|
|
||||||
db.connect()
|
|
||||||
|
|
||||||
# Query the CancelReason table
|
# Query the CancelReason table
|
||||||
cancel_reason = (
|
cancel_reason = (
|
||||||
|
@ -17,9 +15,6 @@ def get_cancel_reason_name(reason_ukr: str):
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
|
||||||
# Close the database connection
|
|
||||||
db.close()
|
|
||||||
|
|
||||||
if cancel_reason:
|
if cancel_reason:
|
||||||
return cancel_reason.name
|
return cancel_reason.name
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue