Fixed
This commit is contained in:
parent
56bb9908d1
commit
6586ac2bfe
@ -74,6 +74,7 @@ def update_crontab(p_my_handler):
|
|||||||
user_ids = []
|
user_ids = []
|
||||||
user_crontab = []
|
user_crontab = []
|
||||||
|
|
||||||
|
if all_users != None:
|
||||||
for element in all_users:
|
for element in all_users:
|
||||||
if element["cron"] != '' and element["telegram_user_id"] != '': # check if both values are existing so I have consistent data
|
if element["cron"] != '' and element["telegram_user_id"] != '': # check if both values are existing so I have consistent data
|
||||||
try:
|
try:
|
||||||
@ -83,6 +84,9 @@ def update_crontab(p_my_handler):
|
|||||||
except:
|
except:
|
||||||
user_ids.pop() # if something goes wrong with cron I have to delete matching user id
|
user_ids.pop() # if something goes wrong with cron I have to delete matching user id
|
||||||
except: continue
|
except: continue
|
||||||
|
else:
|
||||||
|
print("Error with all users from db. Retrying in update_crontab()")
|
||||||
|
update_crontab(p_my_handler)
|
||||||
|
|
||||||
|
|
||||||
print(user_ids)
|
print(user_ids)
|
||||||
@ -136,7 +140,9 @@ def update_for_user(p_user_id, p_my_handler):
|
|||||||
share_amounts = []
|
share_amounts = []
|
||||||
|
|
||||||
my_portfolio = p_my_handler.get_user_portfolio(p_user_id) # get all existing shares for user
|
my_portfolio = p_my_handler.get_user_portfolio(p_user_id) # get all existing shares for user
|
||||||
|
my_portfolio = None
|
||||||
|
|
||||||
|
if my_portfolio!=None:
|
||||||
for element in my_portfolio:
|
for element in my_portfolio:
|
||||||
if element["count"] != '' and element["isin"] != '':
|
if element["count"] != '' and element["isin"] != '':
|
||||||
print(element["count"], element["isin"])
|
print(element["count"], element["isin"])
|
||||||
@ -144,7 +150,7 @@ def update_for_user(p_user_id, p_my_handler):
|
|||||||
share_amounts.append(element["count"])
|
share_amounts.append(element["count"])
|
||||||
|
|
||||||
my_user = p_my_handler.get_user(p_user_id)
|
my_user = p_my_handler.get_user(p_user_id)
|
||||||
send_to_user("Hello %s this is your share update for today:"%str(my_user["username"]), pUser_id=p_user_id)
|
send_to_user("Hello %s this is your update for today:"%str(my_user["username"]), pUser_id=p_user_id)
|
||||||
|
|
||||||
shares = p_my_handler.get_user_shares(p_user_id) # all interest shares
|
shares = p_my_handler.get_user_shares(p_user_id) # all interest shares
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user