closed some conncetions earlier and a little cleanup
parent
dfc8b6236d
commit
b822f4e3f5
|
@ -14,7 +14,6 @@ def get_settings(user_id):
|
||||||
# zdaj imamo problem clasha med globalno in lokalno spremenljivko "dbsession"
|
# zdaj imamo problem clasha med globalno in lokalno spremenljivko "dbsession"
|
||||||
if user == None:
|
if user == None:
|
||||||
print("user je bil none")
|
print("user je bil none")
|
||||||
dbsession = get_session()
|
|
||||||
user = dbsession.query(User).get(user_id)
|
user = dbsession.query(User).get(user_id)
|
||||||
print("User je: ", user)
|
print("User je: ", user)
|
||||||
|
|
||||||
|
@ -29,6 +28,7 @@ def get_settings(user_id):
|
||||||
else:
|
else:
|
||||||
settings_dict = json.loads(settings_db)
|
settings_dict = json.loads(settings_db)
|
||||||
|
|
||||||
|
dbsession.close()
|
||||||
print("this is it: ", settings_dict)
|
print("this is it: ", settings_dict)
|
||||||
return settings_dict
|
return settings_dict
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ def is_due(card_id):
|
||||||
|
|
||||||
last_rating_date = dbsession.query(Rating).filter(Rating.card_id == card_id).order_by(desc(Rating.rating_time)).first()
|
last_rating_date = dbsession.query(Rating).filter(Rating.card_id == card_id).order_by(desc(Rating.rating_time)).first()
|
||||||
if last_rating_date == None:
|
if last_rating_date == None:
|
||||||
|
dbsession.close()
|
||||||
return True
|
return True
|
||||||
due_date = last_rating_date.rating_time + timedelta(interval)
|
due_date = last_rating_date.rating_time + timedelta(interval)
|
||||||
dbsession.close()
|
dbsession.close()
|
||||||
|
@ -128,12 +129,9 @@ def get_a_card_by_status(user_id, card_status):
|
||||||
if card_status == "new":
|
if card_status == "new":
|
||||||
l = list_of_new_cards_by_ids(user_id)
|
l = list_of_new_cards_by_ids(user_id)
|
||||||
card_id = l[0]
|
card_id = l[0]
|
||||||
print(l, "00000000" , card_id)
|
|
||||||
if card_status == "due":
|
if card_status == "due":
|
||||||
l = list_of_due_cards_by_ids(user_id)
|
l = list_of_due_cards_by_ids(user_id)
|
||||||
card_id = l[0]
|
card_id = l[0]
|
||||||
print(l, "00000000" , card_id)
|
|
||||||
|
|
||||||
return card_id
|
return card_id
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue