You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below is not optimised and can cause long delays and broad results.
parkings = Parking.objects.filter(lat__gte=min_lat, lat__lte=max_lat, long__gte=min_long, long__lte=max_long).all()
rtype = RateType.objects.filter(parkingID__in=parkings).all()
rprice = RatePrice.objects.filter(rateID__in=rtype).all()
# To cache whole querysets
# FIXME: We need workaround where no extra work done
bool(parkings)
bool(rtype)
bool(rprice)
parkings = list(geosearch['parkings']) # Here we have list of dicts
rtype = geosearch['ratetype']
rprice = geosearch['rateprice']
for p_item in parkings:
sub_ratetype = rtype.filter(parkingID=p_item.parkingID)
for rt_item in sub_ratetype:
rt_item.rateprice = list(rprice.filter(rateID=rt_item.rateID))
p_item.ratetype = sub_ratetype
In general, we need to limit the maximum number of rows returned (e.g. to not return carparks for the entire world) by either:
a) Limiting the difference between min and max lat/long
b) Limiting max count of rows returned
The text was updated successfully, but these errors were encountered:
The code below is not optimised and can cause long delays and broad results.
In general, we need to limit the maximum number of rows returned (e.g. to not return carparks for the entire world) by either:
a) Limiting the difference between min and max lat/long
b) Limiting max count of rows returned
The text was updated successfully, but these errors were encountered: