Skip to content

Fix poi_info returning null properties for unrated POIs - #7

Open
paumas wants to merge 1 commit into
mainfrom
fix/poi-info-null-rating
Open

paumas wants to merge 1 commit into
mainfrom
fix/poi-info-null-rating

Conversation

@paumas

@paumas paumas commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • places.poi_info folds places.poi.rating into properties via jsonb_set(attr, '{rating}', to_jsonb(rating)). jsonb_set is strict, so a NULL rating (any POI with no ratings — currently the vast majority) makes the whole properties value come back NULL, not just the rating key.
  • On the openmap.lt side, every caller of this function treats properties: null as "not found" and silently no-ops — this made POI selection appear broken for most objects, most visibly through the AI search chat's poi: links (UI: DI dialogas užimą beveik visą mobilaus ekraną openmap.lt#69 investigation).
  • Fix: only merge in a rating key when one actually exists; otherwise return attr unchanged.

Test plan

  • Verified against the tunneled dev/prod DB directly: places.poi_info('{"id": "12107", "mapType": "places"}'::jsonb) returned properties: null before the fix and the correct attributes after, for a real unrated POI.
  • Re-deploy via Jenkins and spot-check a POI without a rating in the app.

🤖 Generated with Claude Code

jsonb_set(attr, '{rating}', to_jsonb(rating)) is strict, so a NULL
rating (any POI with no ratings yet, i.e. most of them) made the
entire `properties` value come back NULL instead of just missing the
rating key. Callers on the openmap.lt side treat a null properties
field as "not found" and silently no-op, which looked like POI
selection was broken for most objects.

Only merge in a rating key when one actually exists; otherwise return
attr unchanged.
@paumas
paumas requested a review from tomass September 3, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants