[openstreetmap/openstreetmap-website] Take entrances into account for routing start and end points (PR #7017)
Sarah Hoffmann
notifications at github.com
Tue Apr 21 20:58:02 UTC 2026
@lonvia commented on this pull request.
> + let ll = null;
+ // if the place has entrances, use their location in preference
+ if (json[0].entrances) {
+ for (const e of json[0].entrances) {
+ if (e.type === "main") {
+ ll = e;
+ break;
+ }
+ if (!ll && e.type === "yes") {
+ ll = e;
+ }
+ }
+ }
+ if (!ll) {
+ ll = json[0];
+ }
I agree that readability wasn't ideal. But we can't have a solution that traverses the list twice, can't we? So here is another proposal that expresses intent a bit better. The actual traversal function still is a bit overly clever. Sorry about that.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7017?email_source=notifications&email_token=AAK2OLNGQSNBTS5DNQVUYUD4W7OFVA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMJVGA3TGMRZGM42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOS6XA4S7OJSXM2LFO5PW433UNFTGSY3BORUW63TTL5RWY2LDNM#discussion_r3120268329
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/7017/review/4150732939 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260421/fe0a48d5/attachment.htm>
More information about the rails-dev
mailing list