Skip to content

Commit

Permalink
fix: fixed values unpacking
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgiolaga committed Nov 3, 2024
1 parent 4ce9b1b commit 5ac0bd8
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion callbacks/participants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def participants(update: Update, context: CallbackContext):
answer = "Prima di iniziare con le danze, avvia una partita, per farlo usa /start"
context.bot.send_message(chat_id=update.effective_chat.id, parse_mode='markdown', text=answer)
else:
players, day, time, target, default_message, pitch = find_all_info_by_chat_id(chat_id)
players, day, time, target, default_message, pitch, _, _ = find_all_info_by_chat_id(chat_id)
current_situation = format_summary(players, day, time, target, default_message, pitch)
msg = print_new_summary(current_situation, update, context)
update_bot_last_message_id_on_db(chat_id, msg.message_id)
4 changes: 2 additions & 2 deletions callbacks/set_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def set_day(update: Update, context: CallbackContext):
day = flatten_args(context.args)
update_day_on_db(chat_id, day)
remove_job_if_exists(str(chat_id), context)
players, day, time, target, custom_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(chat_id)
players, day, time, target, _, pitch, _, bot_last_message_id = find_all_info_by_chat_id(chat_id)
trigger_payment_reminder(update, context, day, time)
sender = "@" + get_sender_name(update)
answer = "Ok, " + sender + "! Ho impostato il giorno della partita il " + day
context.bot.send_message(chat_id=update.effective_chat.id, parse_mode='markdown', text=escape_markdown(answer))
players, day, time, target, default_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(chat_id)
players, day, time, target, default_message, pitch, _, bot_last_message_id = find_all_info_by_chat_id(chat_id)
current_situation = format_summary(players, day, time, target, default_message, pitch)
if bot_last_message_id is None:
msg = print_new_summary(current_situation, update, context)
Expand Down
3 changes: 1 addition & 2 deletions callbacks/set_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def set_description(update: Update, context: CallbackContext):
sender = "@" + get_sender_name(update)
answer = "Ok, " + sender + "! Ho aggiornato la descrizione!"
context.bot.send_message(chat_id=update.effective_chat.id, parse_mode='markdown', text=escape_markdown(answer))
players, day, time, target, default_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(
chat_id)
players, day, time, target, default_message, pitch, _, bot_last_message_id = find_all_info_by_chat_id(chat_id)
current_situation = format_summary(players, day, time, target, default_message, pitch)
if bot_last_message_id is None:
msg = print_new_summary(current_situation, update, context)
Expand Down
3 changes: 1 addition & 2 deletions callbacks/set_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def set_number(update: Update, context: CallbackContext):
update_target_on_db(chat_id, choosen_number)
answer = "Ok, " + sender + "! Ho impostato il numero di partecipanti a " + str(choosen_number)
reached_target = players and participants_num == choosen_number
players, day, time, target, default_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(
chat_id)
players, day, time, target, default_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(chat_id)
current_situation = format_summary(players, day, time, target, default_message, pitch)
if bot_last_message_id is None:
msg = print_new_summary(current_situation, update, context)
Expand Down
3 changes: 1 addition & 2 deletions callbacks/set_pitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def set_pitch(update: Update, context: CallbackContext):
sender = "@" + get_sender_name(update)
answer = "Ok, " + sender + "! Ho aggiornato il campo!"
context.bot.send_message(chat_id=update.effective_chat.id, parse_mode='markdown', text=escape_markdown(answer))
players, day, time, target, default_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(
chat_id)
players, day, time, target, default_message, pitch, _, bot_last_message_id = find_all_info_by_chat_id(chat_id)
current_situation = format_summary(players, day, time, target, default_message, pitch)
if bot_last_message_id is None:
msg = print_new_summary(current_situation, update, context)
Expand Down
5 changes: 2 additions & 3 deletions callbacks/set_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ def set_time(update: Update, context: CallbackContext):
time = flatten_args(context.args)
update_time_on_db(chat_id, time)
remove_job_if_exists(str(chat_id), context)
players, day, time, target, custom_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(chat_id)
players, day, time, target, _, pitch, _, bot_last_message_id = find_all_info_by_chat_id(chat_id)
trigger_payment_reminder(update, context, day, time)
sender = "@" + get_sender_name(update)
answer = "Ok, " + sender + "! Ho impostato l'orario della partita alle " + time
context.bot.send_message(chat_id=update.effective_chat.id, parse_mode='markdown', text=escape_markdown(answer))
players, day, time, target, default_message, pitch, teams, bot_last_message_id = find_all_info_by_chat_id(
chat_id)
players, day, time, target, default_message, pitch, _, bot_last_message_id = find_all_info_by_chat_id(chat_id)
current_situation = format_summary(players, day, time, target, default_message, pitch)
if bot_last_message_id is None:
msg = print_new_summary(current_situation, update, context)
Expand Down
2 changes: 1 addition & 1 deletion test/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_participants(self, mock_find_row_by_chat_id, mock_find_all_info_by_chat
# Test case 2: row is not None
with self.subTest("Row is not None"):
mock_find_row_by_chat_id.return_value = "row"
mock_find_all_info_by_chat_id.return_value = ("player1, player2", "day", "time", "target", "default_message", "pitch")
mock_find_all_info_by_chat_id.return_value = ("player1, player2", "day", "time", "target", "default_message", "pitch", None, None)
mock_format_summary.return_value = "formatted_summary"
mock_print_new_summary.return_value = MagicMock(message_id=123)

Expand Down

0 comments on commit 5ac0bd8

Please sign in to comment.