Skip to content

Commit

Permalink
fix: alert does not appear
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisfabrics committed Oct 25, 2024
1 parent 1c6f98d commit e861f06
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/bot/routers/booking/widgets/time_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ async def _render_keyboard(self, data: dict, manager: DialogManager) -> list[lis
else:
assert_never(timepoint)
keyboard_builer.button(text=text, callback_data=time_callback_data)
elif (
available and not blocked and ((timepoint.hour, timepoint.minute) != (22, 30) or endpoint_time_selected)
):
elif available and not blocked and (timepoint.hour, timepoint.minute) != (22, 30):
keyboard_builer.button(text=time_text, callback_data=time_callback_data)
elif booked_by_someone:
booking = already_booked_timepoints[timepoint]
Expand All @@ -159,13 +157,14 @@ async def _render_keyboard(self, data: dict, manager: DialogManager) -> list[lis
keyboard_builer.button(text="🟢", callback_data=none_callback_data)
else:
keyboard_builer.button(text="🔴", url=f"https://t.me/{booked_by_alias}")
elif timepoint.hour == 22 and timepoint.minute == 30 and room_was_booked_for_10pm:
if booker_of_room_for_10pm == manager.event.from_user.username:
keyboard_builer.button(text="🟢", callback_data=none_callback_data)
else:
keyboard_builer.button(text="🔴", url=f"https://t.me/{booked_by_alias}")
elif timepoint.hour == 22 and timepoint.minute == 30 and available:
keyboard_builer.button(text=time_text, callback_data=none_callback_data)
elif timepoint.hour == 22 and timepoint.minute == 30:
if room_was_booked_for_10pm:
if booker_of_room_for_10pm == manager.event.from_user.username:
keyboard_builer.button(text="🟢", callback_data=none_callback_data)
else:
keyboard_builer.button(text="🔴", url=f"https://t.me/{booked_by_alias}")
elif available and not blocked:
keyboard_builer.button(text=time_text, callback_data=time_callback_data)
else:
keyboard_builer.button(
text=" ",
Expand All @@ -189,6 +188,7 @@ async def _process_item_callback(
:return: True if processed
"""
widget_data = self.get_widget_data(manager, [])

if data == "None":
if widget_data:
self.set_widget_data(manager, [])
Expand All @@ -200,8 +200,8 @@ async def _process_item_callback(

endpoint_timepoints = self.get_widget_data(manager, [])

if clicked_timepoint == "22:30" and not endpoint_timepoints:
await callback.answer("Музкомнату можно бронировать только до 22:30", show_alert=True)
if data == "22:30" and not endpoint_timepoints:
await callback.answer("Music Room can be booked till 22:30 only!", True)
return False

if clicked_timepoint in endpoint_timepoints:
Expand Down

0 comments on commit e861f06

Please sign in to comment.