@@ -432,14 +432,11 @@ export const updateListingGeocoordinates = (id, latitude, longitude) => {
432432 *
433433 * @param {Object } params
434434 * @param {string } [params.jobId]
435- * @param {boolean } [params.activeOnly=true]
436- * @param {number } [params.minPrice]
437- * @param {number } [params.maxPrice]
438435 * @param {string } [params.userId]
439436 * @param {boolean } [params.isAdmin=false]
440437 * @returns {{listings: Object[], maxPrice: number} } Object containing listings and maxPrice.
441438 */
442- export const getListingsForMap = ( { jobId, minPrice , maxPrice , userId = null , isAdmin = false } = { } ) => {
439+ export const getListingsForMap = ( { jobId, userId = null , isAdmin = false } = { } ) => {
443440 const baseWhereParts = [
444441 'l.latitude IS NOT NULL' ,
445442 'l.longitude IS NOT NULL' ,
@@ -461,15 +458,6 @@ export const getListingsForMap = ({ jobId, minPrice, maxPrice, userId = null, is
461458 }
462459
463460 const wherePartsForListings = [ ...baseWhereParts ] ;
464- if ( minPrice !== undefined && minPrice !== null ) {
465- params . minPrice = minPrice ;
466- wherePartsForListings . push ( 'l.price >= @minPrice' ) ;
467- }
468-
469- if ( maxPrice !== undefined && maxPrice !== null ) {
470- params . maxPrice = maxPrice ;
471- wherePartsForListings . push ( 'l.price <= @maxPrice' ) ;
472- }
473461
474462 const listings = SqliteConnection . query (
475463 `SELECT l.*, j.name AS job_name
@@ -479,17 +467,8 @@ export const getListingsForMap = ({ jobId, minPrice, maxPrice, userId = null, is
479467 params ,
480468 ) ;
481469
482- const maxPriceRow = SqliteConnection . query (
483- `SELECT MAX(l.price) AS maxPrice
484- FROM listings l
485- LEFT JOIN jobs j ON j.id = l.job_id
486- WHERE ${ baseWhereParts . join ( ' AND ' ) } ` ,
487- params ,
488- ) [ 0 ] ;
489-
490470 return {
491471 listings,
492- maxPrice : maxPriceRow ?. maxPrice || 0 ,
493472 } ;
494473} ;
495474
0 commit comments