From 4efba6da675d155ba77c274172aa7183508f5c19 Mon Sep 17 00:00:00 2001 From: Kris Jordan Date: Fri, 8 Mar 2024 10:13:28 -0500 Subject: [PATCH] Room reservation soft launch improvements (#324) * Add office hours for room reservation soft launch * Hot fix for reservable rooms --- backend/services/coworking/policy.py | 48 +++++------------------ backend/services/coworking/reservation.py | 6 ++- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/backend/services/coworking/policy.py b/backend/services/coworking/policy.py index 813eaac73..b43236559 100644 --- a/backend/services/coworking/policy.py +++ b/backend/services/coworking/policy.py @@ -74,12 +74,8 @@ def office_hours(self, date: datetime): day = date.weekday() if day == MONDAY: return { - 'SN135' : [ - (time(hour=16, minute=30), time(hour=17, minute=00)), - ], - 'SN137' : [ - (time(hour=15, minute=00), time(hour=16, minute=30)) - ], + 'SN135' : [], + 'SN137' : [], 'SN139' : [], 'SN141' : [ (time(hour=16, minute=00), time(hour=17, minute=30)) @@ -87,58 +83,34 @@ def office_hours(self, date: datetime): } elif day == TUESDAY: return { - 'SN135' : [ - (time(hour=14, minute=30), time(hour=16, minute=00)), - (time(hour=11, minute=00), time(hour=12, minute=00)) - ], + 'SN135' : [], 'SN137' : [], - 'SN139' : [ - (time(hour=10, minute=30), time(hour=11, minute=00)), - (time(hour=11, minute=30), time(hour=13, minute=00)), - ], + 'SN139' : [], 'SN141' : [ (time(hour=10, minute=00), time(hour=11, minute=00)) ] } elif day == WEDNESDAY: return { - 'SN135' : [ - (time(hour=11, minute=00), time(hour=12, minute=00)) - ], + 'SN135' : [], 'SN137' : [], - 'SN139' : [ - (time(hour=10, minute=30), time(hour=11, minute=00)), - (time(hour=11, minute=30), time(hour=13, minute=00)), - (time(hour=14, minute=30), time(hour=15, minute=00)) - ], + 'SN139' : [], 'SN141' : [ (time(hour=10, minute=00), time(hour=11, minute=00)) ] } elif day == THURSDAY: return { - 'SN135' : [ - (time(hour=14, minute=30), time(hour=16, minute=00)), - (time(hour=11, minute=00), time(hour=12, minute=00)) - ], + 'SN135' : [], 'SN137' : [], - 'SN139' : [ - (time(hour=10, minute=30), time(hour=11, minute=00)), - (time(hour=11, minute=30), time(hour=13, minute=00)), - (time(hour=14, minute=30), time(hour=15, minute=00)) - ], + 'SN139' : [], 'SN141' : [] } elif day == FRIDAY: return { - 'SN135' : [ - (time(hour=11, minute=00), time(hour=12, minute=00)) - ], + 'SN135' : [], 'SN137' : [], - 'SN139' : [ - (time(hour=10, minute=30), time(hour=11, minute=00)), - (time(hour=14, minute=30), time(hour=15, minute=00)) - ], + 'SN139' : [], 'SN141' : [ (time(hour=10, minute=00), time(hour=11, minute=00)) ] diff --git a/backend/services/coworking/reservation.py b/backend/services/coworking/reservation.py index 38b38d5bc..30a5fe69f 100644 --- a/backend/services/coworking/reservation.py +++ b/backend/services/coworking/reservation.py @@ -355,7 +355,8 @@ def get_map_reserved_times_by_date( reserved_date_map[room.id] = time_slots_for_room self._transform_date_map_for_unavailable(reserved_date_map) - del reserved_date_map["SN156"] + if "SN156" in reserved_date_map: + del reserved_date_map["SN156"] self._transform_date_map_for_officehours( date, reserved_date_map, operating_hours_start, operating_hours_duration ) @@ -521,7 +522,8 @@ def _get_reservable_rooms(self) -> Sequence[RoomDetails]: rooms = ( self._session.query(RoomEntity) - .filter(RoomEntity.id.not_in(self._policy_svc.non_reservable_rooms())) + # .where(RoomEntity.id.not_in(self._policy_svc.non_reservable_rooms())) + .where(RoomEntity.reservable == True) .order_by(RoomEntity.id) .all() )