forked from MapComplete/MapComplete
Fix import helper
This commit is contained in:
parent
627ae356b9
commit
244882d534
2 changed files with 10 additions and 7 deletions
|
@ -18,7 +18,7 @@ export default class FilteringFeatureSource implements FeatureSourceForLayer, Ti
|
||||||
private readonly state: {
|
private readonly state: {
|
||||||
locationControl: Store<{ zoom: number }>
|
locationControl: Store<{ zoom: number }>
|
||||||
selectedElement: Store<any>
|
selectedElement: Store<any>
|
||||||
globalFilters: Store<{ filter: FilterState }[]>
|
globalFilters?: Store<{ filter: FilterState }[]>
|
||||||
allElements: ElementStorage
|
allElements: ElementStorage
|
||||||
}
|
}
|
||||||
private readonly _alreadyRegistered = new Set<UIEventSource<any>>()
|
private readonly _alreadyRegistered = new Set<UIEventSource<any>>()
|
||||||
|
@ -30,7 +30,7 @@ export default class FilteringFeatureSource implements FeatureSourceForLayer, Ti
|
||||||
locationControl: Store<{ zoom: number }>
|
locationControl: Store<{ zoom: number }>
|
||||||
selectedElement: Store<any>
|
selectedElement: Store<any>
|
||||||
allElements: ElementStorage
|
allElements: ElementStorage
|
||||||
globalFilters: Store<{ filter: FilterState }[]>
|
globalFilters?: Store<{ filter: FilterState }[]>
|
||||||
},
|
},
|
||||||
tileIndex,
|
tileIndex,
|
||||||
upstream: FeatureSourceForLayer,
|
upstream: FeatureSourceForLayer,
|
||||||
|
@ -63,7 +63,7 @@ export default class FilteringFeatureSource implements FeatureSourceForLayer, Ti
|
||||||
self._is_dirty.setData(true)
|
self._is_dirty.setData(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
state.globalFilters.addCallback((_) => {
|
state.globalFilters?.addCallback((_) => {
|
||||||
self.update()
|
self.update()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ export default class FilteringFeatureSource implements FeatureSourceForLayer, Ti
|
||||||
const features: { feature: OsmFeature; freshness: Date }[] =
|
const features: { feature: OsmFeature; freshness: Date }[] =
|
||||||
this.upstream.features.data ?? []
|
this.upstream.features.data ?? []
|
||||||
const includedFeatureIds = new Set<string>()
|
const includedFeatureIds = new Set<string>()
|
||||||
const globalFilters = self.state.globalFilters.data.map((f) => f.filter)
|
const globalFilters = self.state.globalFilters?.data?.map((f) => f.filter)
|
||||||
const newFeatures = (features ?? []).filter((f) => {
|
const newFeatures = (features ?? []).filter((f) => {
|
||||||
self.registerCallback(f.feature)
|
self.registerCallback(f.feature)
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ export default class FilteringFeatureSource implements FeatureSourceForLayer, Ti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const filter of globalFilters) {
|
for (const filter of (globalFilters ?? [])) {
|
||||||
const neededTags: TagsFilter = filter?.currentFilter
|
const neededTags: TagsFilter = filter?.currentFilter
|
||||||
if (
|
if (
|
||||||
neededTags !== undefined &&
|
neededTags !== undefined &&
|
||||||
|
|
|
@ -128,7 +128,7 @@ class MassAction extends Combine {
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
// This was a one-off for one of the first imports
|
// This was a one-off for one of the first imports
|
||||||
value:{
|
value:{
|
||||||
predicate: p => p.status === "open" && p.comments[0].text.split("\n").find(l => l.startsWith("note=")) !== undefined,
|
predicate: p => p.status === "open" && p.comments[0].text.split("\n").find(l => l.startsWith("note=")) !== undefined,
|
||||||
action: async p => {
|
action: async p => {
|
||||||
|
@ -440,7 +440,10 @@ class ImportInspector extends VariableUiElement {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// We only care about the properties here
|
// We only care about the properties here
|
||||||
const props: NoteProperties[] = notes["success"].features.map((f) => f.properties)
|
let props: NoteProperties[] = notes["success"].features.map((f) => f.properties)
|
||||||
|
if(userDetails["uid"]){
|
||||||
|
props = props.filter(n => n.comments[0].uid === userDetails["uid"])
|
||||||
|
}
|
||||||
const perBatch: NoteState[][] = Array.from(
|
const perBatch: NoteState[][] = Array.from(
|
||||||
ImportInspector.SplitNotesIntoBatches(props).values()
|
ImportInspector.SplitNotesIntoBatches(props).values()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue