forked from MapComplete/MapComplete
Simplify handling of id rewrites by centralizing them to the changesethandler (which improves testability too), fixes a part of #564
This commit is contained in:
parent
c3f3f69c3b
commit
9238f0f381
7 changed files with 232 additions and 96 deletions
|
@ -51,22 +51,6 @@ export default class CreateNewNodeAction extends OsmCreateAction {
|
|||
}
|
||||
}
|
||||
|
||||
public static registerIdRewrites(mappings: Map<string, string>) {
|
||||
const toAdd: [string, number][] = []
|
||||
|
||||
this.previouslyCreatedPoints.forEach((oldId, key) => {
|
||||
if (!mappings.has("node/" + oldId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newId = Number(mappings.get("node/" + oldId).substr("node/".length))
|
||||
toAdd.push([key, newId])
|
||||
})
|
||||
for (const [key, newId] of toAdd) {
|
||||
CreateNewNodeAction.previouslyCreatedPoints.set(key, newId)
|
||||
}
|
||||
}
|
||||
|
||||
async CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
|
||||
|
||||
if (this._reusePreviouslyCreatedPoint) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue