Skip to content

Commit

Permalink
add type information to references
Browse files Browse the repository at this point in the history
  • Loading branch information
mstn committed Mar 2, 2017
1 parent 3205650 commit 05e5cf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion modules/services/osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ export default {
// find a referenced relation in the current changeset
function resolve(item){
return _.find(relations, function(relation) {
return item.keyAttributes.ref === relation['@id'];
return item.keyAttributes.type === 'relation'
&& item.keyAttributes.ref === relation['@id'];
});
}
// a new item is an item that has not been already processed
Expand Down
8 changes: 4 additions & 4 deletions test/spec/services/osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ describe('iD.serviceOsm', function () {
it('includes creations ordered by dependencies', function() {
var n = iD.Node({loc: [0, 0]}),
w = iD.Way({nodes: [n.id]}),
r1 = iD.Relation({members: [{id: w.id}]}),
r2 = iD.Relation({members: [{id: r1.id}]}),
r1 = iD.Relation({members: [{id: w.id, type: 'way'}]}),
r2 = iD.Relation({members: [{id: r1.id, type: 'relation'}]}),
changes = {created: [r2, r1, w, n], modified: [], deleted: []},
jxon = connection.osmChangeJXON('1234', changes);

Expand All @@ -381,8 +381,8 @@ describe('iD.serviceOsm', function () {
var r1 = iD.Relation(),
r2 = iD.Relation(),
changes, jxon;
r1.addMember({id: r2.id});
r2.addMember({id: r1.id});
r1.addMember({id: r2.id, type: 'relation'});
r2.addMember({id: r1.id, type: 'relation'});
changes = {created: [r1,r2], modified: [], deleted: []};
jxon = connection.osmChangeJXON('1234', changes);

Expand Down

0 comments on commit 05e5cf9

Please sign in to comment.