Example #1
0
 def resolve_analytics_ratios_per_room(self,
                                       info,
                                       start_date,
                                       end_date=None):  # noqa: E501
     query = Room.get_query(info)
     ratio = RoomAnalyticsRatios.get_analytics_ratios_per_room(
         self, query, start_date, end_date)
     return RatiosPerRoom(ratio)
Example #2
0
 def resolve_bookings_analytics_count(self, info, **kwargs):
     start_date, end_date, room_id = (kwargs.get('start_date'),
                                      kwargs.get('end_date'),
                                      kwargs.get('room_id'))
     query = Room.get_query(info)
     analytics = RoomAnalyticsRatios.get_bookings_analytics_count(
         self, query, start_date, end_date, room_id=room_id)
     return analytics
Example #3
0
 def resolve_analytics_ratios_per_room(self, info, **kwargs):
     room_id = kwargs.get('room_id')
     query = Room.get_query(info)
     ratio = RoomAnalyticsRatios.get_analytics_ratios_per_room(
         self, query, kwargs.get('start_date'), kwargs.get('end_date'),
         **kwargs)
     if room_id:
         exact_room = query.filter(RoomModel.id == room_id).first()
         if not exact_room:
             raise GraphQLError("Room not found")
         return RatiosPerRoom(ratios=[], ratio=ratio)
     return RatiosPerRoom(ratios=ratio, ratio={})
Example #4
0
 def resolve_bookings_analytics_count(self, info, start_date,
                                      end_date):  # noqa: E501
     query = Room.get_query(info)
     analytics = RoomAnalyticsRatios.get_bookings_analytics_count(
         self, query, start_date, end_date)
     return analytics
Example #5
0
 def resolve_analytics_ratios(self, info, start_date, end_date=None):
     query = Room.get_query(info)
     ratio = RoomAnalyticsRatios.get_analytics_ratios(
         self, query, start_date, end_date)
     return ratio