Skip to content

Commit

Permalink
Include num_changes field as changes_count in changeset xml&json resp…
Browse files Browse the repository at this point in the history
…onse

Fixes zerebubuth#156
  • Loading branch information
mmd-osm committed Aug 14, 2018
1 parent 3940f26 commit 2931c8d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/json_formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ void json_formatter::write_changeset(const changeset_info &elem,
writer->object_key("comments_count");
writer->entry_int(elem.comments_count);

writer->object_key("changes_count");
writer->entry_int(elem.num_changes);

write_tags(tags);

if (include_comments && !comments.empty()) {
Expand Down
1 change: 1 addition & 0 deletions src/xml_formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ void xml_formatter::write_changeset(const changeset_info &elem,
}

writer->attribute("comments_count", elem.comments_count);
writer->attribute("changes_count", elem.num_changes);

write_tags(tags);

Expand Down
2 changes: 1 addition & 1 deletion test/changesets.testcore/read.case
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Content-Type: text/xml; charset=utf-8
!Content-Disposition:
---
<osm version="0.6" generator="***" copyright="***" attribution="***" license="***">
<changeset id="1" user="FakeUser1" uid="1" created_at="2015-08-09T10:33:13Z" closed_at="2015-08-09T11:33:13Z" open="false" min_lat="51.5288506" min_lon="-0.1465242" max_lat="51.5288620" max_lon="-0.1464925" comments_count="1">
<changeset id="1" user="FakeUser1" uid="1" created_at="2015-08-09T10:33:13Z" closed_at="2015-08-09T11:33:13Z" open="false" min_lat="51.5288506" min_lon="-0.1465242" max_lat="51.5288620" max_lon="-0.1464925" comments_count="1" changes_count="1">
<tag k="created_by" v="manually"/>
</changeset>
</osm>
2 changes: 1 addition & 1 deletion test/changesets.testcore/read_discussion.case
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Content-Type: text/xml; charset=utf-8
!Content-Disposition:
---
<osm version="0.6" generator="***" copyright="***" attribution="***" license="***">
<changeset id="1" user="FakeUser1" uid="1" created_at="2015-08-09T10:33:13Z" closed_at="2015-08-09T11:33:13Z" open="false" min_lat="51.5288506" min_lon="-0.1465242" max_lat="51.5288620" max_lon="-0.1464925" comments_count="1">
<changeset id="1" user="FakeUser1" uid="1" created_at="2015-08-09T10:33:13Z" closed_at="2015-08-09T11:33:13Z" open="false" min_lat="51.5288506" min_lon="-0.1465242" max_lat="51.5288620" max_lon="-0.1464925" comments_count="1" changes_count="1">
<tag k="created_by" v="manually"/>
<discussion>
<comment date="2015-08-09T10:33:13Z" uid="1" user="FakeUser1">
Expand Down
2 changes: 1 addition & 1 deletion test/changesets.testcore/read_nonpublic.case
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Content-Type: text/xml; charset=utf-8
!Content-Disposition:
---
<osm version="0.6" generator="***" copyright="***" attribution="***" license="***">
<changeset id="2" created_at="2015-09-05T20:16:06Z" closed_at="2015-09-05T20:16:06Z" comments_count="0" open="false"/>
<changeset id="2" created_at="2015-09-05T20:16:06Z" closed_at="2015-09-05T20:16:06Z" comments_count="0" changes_count="0" open="false"/>
</osm>
2 changes: 1 addition & 1 deletion test/changesets.testcore/read_open.case
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Content-Type: text/xml; charset=utf-8
!Content-Disposition:
---
<osm version="0.6" generator="***" copyright="***" attribution="***" license="***">
<changeset id="1" user="FakeUser1" uid="1" created_at="2015-08-09T10:33:13Z" open="true" min_lat="51.5288506" min_lon="-0.1465242" max_lat="51.5288620" max_lon="-0.1464925" comments_count="1">
<changeset id="1" user="FakeUser1" uid="1" created_at="2015-08-09T10:33:13Z" open="true" min_lat="51.5288506" min_lon="-0.1465242" max_lat="51.5288620" max_lon="-0.1464925" comments_count="1" changes_count="1">
<tag k="created_by" v="manually"/>
</changeset>
</osm>

0 comments on commit 2931c8d

Please sign in to comment.