[openstreetmap/openstreetmap-website] Fix month label index desync causing missing labels (PR #6725)
Tom Hughes
notifications at github.com
Tue Jan 20 18:39:06 UTC 2026
tomhughes left a comment (openstreetmap/openstreetmap-website#6725)
As I suspected, changing the server code to this:
```ruby
# Get unique months with repeating months and count into the next year with numbers over 12
month_offset = 0
months = ((from - 2.weeks).to_date..(to + 1.week).to_date)
.map(&:month)
.chunk_while { |before, after| before == after }
.map(&:first)
months = months.take(1) + months.drop(1).map do |month|
month_offset += 12 if month == 1
month + month_offset
end
```
which only adds the extra offset when we see January after another month fixes the problem.
That code's not very nice though and so far I haven't come up with a cleaner way to do it...
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6725#issuecomment-3774385563
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6725/c3774385563 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260120/0b0719ce/attachment.htm>
More information about the rails-dev
mailing list