[openstreetmap/openstreetmap-website] Improve statistucs numbers (PR #5994)

Minh Nguyễn notifications at github.com
Thu May 8 16:14:32 UTC 2025


@1ec5 commented on this pull request.

This will make the stats much more readable at a glance.

Do we know of anything that scrapes this page and possibly expects these numbers to remain unformatted? Does this also affect [the statistics page on the planet site](https://planet.openstreetmap.org/statistics/data_stats.html) or only on the main domain? I’m no fan of scraping pages for stuff like this, but we don’t have an equivalent API endpoint, so I might need to spread the word about this change.

> @@ -23,11 +29,11 @@ begin
     relation_count = Relation.where(:visible => true).count
 
     puts "<table>"
-    puts "<tr><td>Number of users</td><td>#{user_count}</td></tr>"
-    puts "<tr><td>Number of uploaded GPS points</td><td>#{tracepoint_count}</td></tr>"
-    puts "<tr><td>Number of nodes</td><td>#{node_count}</td></tr>"
-    puts "<tr><td>Number of ways</td><td>#{way_count}</td></tr>"
-    puts "<tr><td>Number of relations</td><td>#{relation_count}</td></tr>"
+    puts "<tr><td>Number of users</td><td>#{user_count.format()}</td></tr>"
+    puts "<tr><td>Number of uploaded GPS points</td><td>#{tracepoint_count.format()}</td></tr>"
+    puts "<tr><td>Number of nodes</td><td>#{node_count.format()}</td></tr>"
+    puts "<tr><td>Number of ways</td><td>#{way_count.format()}</td></tr>"
+    puts "<tr><td>Number of relations</td><td>#{relation_count.format()}</td></tr>"

If you’re open to it, an alternative approach would be to add a small amount of JavaScript that [formats the number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString) on the fly.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5994#pullrequestreview-2825679494
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5994/review/2825679494 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250508/a053be1c/attachment.htm>


More information about the rails-dev mailing list