@pablobm commented on this pull request.
> @@ -0,0 +1,131 @@
+# frozen_string_literal: true
+
+module BrowseTagChangesHelper
+ include BrowseTagsHelper
+
+ 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] }
+
+ previous_tags = previous_version&.tags || {}
+
+ tags_added = tags_modified = tags_unmodified = tags_removed =
tags_with_unknown_versioning = {}
I should have realised this earlier:
```ruby
a = b = {}
a[:foo] = 1
a # => {foo: 1}
b # => {foo: 1}
```
(By the way, this is the same in other languages. I just checked in Python and
JS).
Therefore, the assignment needs to be split:
```suggestion
tags_added = {}
tags_modified = {}
tags_unmodified = {}
tags_removed = {}
tags_with_unknown_versioning = {}
```
This doesn't solve the issue that @tomhughes found in a separate comment
(incorrect changes assigned to each versions). Still looking into that one.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6448#pullrequestreview-3875596388
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