Skip to content

Commit

Permalink
Fix re-register
Browse files Browse the repository at this point in the history
  • Loading branch information
annndruha committed Sep 20, 2023
1 parent 0e0682b commit 26799dc
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ async def handler_register(update: Update, context: ContextTypes.DEFAULT_TYPE):
elif r.json() and data is not None:
data.surname = surname
data.number = number
session.commit()
await context.bot.send_message(chat_id=chat_id, text=ans.val_update_pass)
marketing.re_register(tg_id=chat_id, surname=surname, number=number)
logging.info(f'{log_actor(update)} register repeat OK: {surname} {number}')
Expand Down Expand Up @@ -275,14 +276,9 @@ async def __print_settings_solver(update: Update, context: CallbackContext):

def __auth(update):
with Session() as session:
tg_user: TgUser | None = session.query(TgUser).filter(TgUser.tg_id == update.effective_user.id).one_or_none()
if tg_user is not None:
r = requests.get(
settings.PRINT_URL + '/is_union_member',
params=dict(surname=tg_user.surname, number=tg_user.number, v=1),
)
if r.json():
return tg_user.tg_id, tg_user.surname, tg_user.number
data: TgUser | None = session.query(TgUser).filter(TgUser.tg_id == update.effective_user.id).one_or_none()
if data is not None:
return data.tg_id, data.surname, data.number


def __change_message_by_auth(update, text, keyboard):
Expand Down

0 comments on commit 26799dc

Please sign in to comment.