Fix POI distance calculation for buy listings
The distance calculator always queried the rentlisting table regardless of listing type because get_listings() defaulted to RentListing when called without query_parameters. Added a listing_type parameter to get_listings() and _get_model_for_query() so callers can select the correct table directly.
This commit is contained in:
parent
54bdcac14a
commit
e431eaf2aa
2 changed files with 15 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ from typing import Callable
|
|||
import aiohttp
|
||||
|
||||
from config.routing_config import RoutingConfig
|
||||
from models.listing import BuyListing, ListingType, RentListing
|
||||
from models.listing import ListingType
|
||||
from models.poi import PointOfInterest
|
||||
from models.poi_distance import POIDistance
|
||||
from rec.osrm_client import osrm_table
|
||||
|
|
@ -53,10 +53,9 @@ async def calculate_poi_distances(
|
|||
config = RoutingConfig.from_env()
|
||||
|
||||
# Load listings with coordinates
|
||||
model = RentListing if listing_type == ListingType.RENT else BuyListing
|
||||
listings = await listing_repo.get_listings(
|
||||
only_ids=listing_ids,
|
||||
query_parameters=None,
|
||||
listing_type=listing_type,
|
||||
)
|
||||
if not listings:
|
||||
logger.info("No listings found for distance calculation")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue