Skip to content

Commit

Permalink
Force fake null block to compare for radius filter
Browse files Browse the repository at this point in the history
  • Loading branch information
pratishta committed Apr 30, 2024
1 parent 3d3672b commit bbc4950
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions server/src/project/geometry/geometry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ export class GeometryService {
async getBlocksFromRadiusQuery(x, y, radius) {
const queryForBlocks = QUERIES.blocksWithinRadius(x, y, radius);
const distinctBlocks = `SELECT DISTINCT(block) FROM (${queryForBlocks}) blocksWithinRadius`;
// console.log("distinctBlocks", distinctBlocks);
// console.log("distinctblocks records", await this.carto.fetchCarto(queryForBlocks, "json", "post"))
const blocks = await this.carto.fetchCarto(distinctBlocks, "json", "post");

// note: DTM stores blocks with the borough
Expand Down
4 changes: 2 additions & 2 deletions server/src/project/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ export const generateFromTemplate = (query, template) => {
};

function generateProjectsFilterString(query) {
// Special handling for 'block' query, which must be explicitly ignored if empty
// otherwise, unmapped projects will be excluded from the results
// if blocks_in_radius is empty while the radius_filter is on, force api
// to match a non-existant block to return no projects. Otherwise delete attribute
const radius_filter = query.distance_from_point && query.radius_from_point;
if (!Object.keys(query.blocks_in_radius).length) {
radius_filter ? query.blocks_in_radius = ['000000'] : delete query.blocks_in_radius
Expand Down

0 comments on commit bbc4950

Please sign in to comment.