Skip to content

Commit

Permalink
Null safety bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryKogan committed Jun 30, 2022
1 parent b54e29f commit dfd4478
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/questionnaire/data_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def get_user_data_preview(user_id: int) -> str:
return data


def get_check_data(user_id: int) -> (str, float):
def get_check_data(user_id: int) -> (str, float) or None:
user_data = db.users_table.get(user_id)
if user_data is None:
return ""
return None

total_price = SHIRT_PRICE
data = f"Футболка '120' - {SHIRT_PRICE}р."
Expand Down
5 changes: 4 additions & 1 deletion src/questionnaire/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ async def skip_instagram(update, _):

async def get_verification(update, _):
if update.message.text == "Все верно":
message, amount = get_check_data(update.effective_user.id)
check_data = get_check_data(update.effective_user.id)
if check_data is None:
return ConversationHandler.END
message, amount = check_data
await update.message.reply_text(
text=message,
reply_markup=go_to_payment(amount),
Expand Down

0 comments on commit dfd4478

Please sign in to comment.