Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation.replaceMember shouldn't necessarily remove duplicates #4696

Closed
bhousel opened this issue Jan 16, 2018 · 0 comments
Closed

Relation.replaceMember shouldn't necessarily remove duplicates #4696

bhousel opened this issue Jan 16, 2018 · 0 comments
Labels
bug-release-blocker An important bug - let's get this fixed in the next release!

Comments

@bhousel
Copy link
Member

bhousel commented Jan 16, 2018

Also related to #4589

Our current replaceMember behavior removes duplicates from the relation list - I think this is wrong in the context of a Public Transport route relation. We call this function numerous places in the iD code when working with relations.

it('removes members if replacing them would produce duplicates', function () {
var r = iD.Relation({members: [
{id: 'a', role: 'b', type: 'node'},
{id: 'b', role: 'b', type: 'node'}]});
expect(r.replaceMember({id: 'a'}, {id: 'b', type: 'node'}).members).to.eql([{id: 'b', role: 'b', type: 'node'}]);
});

Here is an example of a route that might break if we call replaceMember on it:

Route: A - B - C - B - D

screenshot 2018-01-16 15 02 34

// 'B' is duplicate but should not be removed!
r = iD.osmRelation({members: [
    {id: 'A', role: 'forward', type: 'way'},
    {id: 'B', role: 'forward', type: 'way'},
    {id: 'C', role: 'forward', type: 'way'},
    {id: 'B', role: 'forward', type: 'way'},
    {id: 'D', role: 'forward', type: 'way'}
]});

more reading:

@bhousel bhousel added the bug-release-blocker An important bug - let's get this fixed in the next release! label Jan 16, 2018
@bhousel bhousel added the wip Work in progress label Jan 18, 2018
@bhousel bhousel removed the wip Work in progress label Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-release-blocker An important bug - let's get this fixed in the next release!
Projects
None yet
Development

No branches or pull requests

1 participant