@pablobm commented on this pull request.
> + def wrap_tags_with_version_changes(tags_to_values, _current_version = nil,
> all_versions = [])
+ # Find the previous usable version by looking backwards from the end
+ previous_version = all_versions
+ .reverse
+ .drop(1)
+ .find { |v| !v.redacted? || params[:show_redactions] }
I think the problem is here. We never use `_current_version`, so we always get
the same version as `previous_version`. All comparisons are to... is it the
second to latest version? Whichever.
I think this is the correct code. Note that I have renamed `_current_version`
as `current_version` as we are now using it:
```suggestion
def wrap_tags_with_version_changes(tags_to_values, current_version = nil,
all_versions = [])
# Find the previous usable version by looking backwards from the end
usable_versions_in_order =
all_versions
.reverse
.filter { |v| !v.redacted? || params[:show_redactions] }
current_version_index = usable_versions_in_order.find_index { |v| v.version
== current_version }
previous_version = usable_versions_in_order[current_version_index + 1]
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6448#pullrequestreview-3875688370
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/6448/review/[email protected]>_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev