Fix issue w/ Lastable service

This commit is contained in:
Kuroshini 2019-10-03 20:41:26 +03:00
parent 3da57b72fc
commit 3f6aa21005
2 changed files with 4 additions and 4 deletions

View File

@ -141,9 +141,9 @@ class LastableService(AbstractBookingService):
super().check_whether_booking_available(restaurant_id, date)
url = f'{self.url}v1/restaurant/{restaurant_id}/offers'
r = requests.get(url, headers=self.get_common_headers(), proxies=self.proxies)
if not status.is_success(r.status_code):
return False
response = json.loads(r.content)['data']
if not status.is_success(r.status_code) or not response:
return False
self.response = response
return True

View File

@ -22,12 +22,12 @@ class CheckWhetherBookingAvailable(generics.GenericAPIView):
date = request.query_params.get('date')
g_service = GuestonlineService()
l_service = LastableService()
if not establishment.lastable_id is None and l_service \
if (not establishment.lastable_id is None) and l_service \
.check_whether_booking_available(establishment.lastable_id, date):
is_booking_available = True
service = l_service
service.service_id = establishment.lastable_id
elif not establishment.guestonline_id is None and g_service \
elif (not establishment.guestonline_id is None) and g_service \
.check_whether_booking_available(establishment.guestonline_id, date):
is_booking_available = True
service = g_service