[openstreetmap/openstreetmap-website] Add Communities page (#3301)
Andy Allan
notifications at github.com
Wed Mar 2 17:39:32 UTC 2022
@gravitystorm commented on this pull request.
> + end
+
+ def self.init_local_chapters
+ raw_local_chapters = load_raw_local_chapters
+ local_chapters = []
+ raw_local_chapters.each do |chapter|
+ id = chapter[:id]
+ url = chapter[:resource]["strings"]["url"]
+ local_chapters.push(LocalChapter.new(id, url))
+ end
+ local_chapters
+ end
+
+ def self.load_raw_local_chapters
+ community_index = OsmCommunityIndex.community_index
+ raw_local_chapters = []
`map ... .compact` rather than `foo = [] ... each ... unless x; foo.push(bar)` to make this easier to read. Or if we were on ruby 2.7+ (which we aren't yet) we could use [`Enumerable.filter_map`](https://blog.saeloun.com/2019/05/25/ruby-2-7-enumerable-filter-map.html)
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3301#pullrequestreview-897927033
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3301/review/897927033 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220302/113bb94a/attachment.htm>
More information about the rails-dev
mailing list