Debugging issues with broken sources

This commit is contained in:
efarooqui
2020-09-22 10:26:05 -07:00
parent 3b4efc0cce
commit a4cd28d19f
3 changed files with 15 additions and 20 deletions

View File

@@ -136,7 +136,6 @@ class CardStack extends React.Component {
render () {
const { isCardstack, selected, narrative, timelineDims } = this.props
// TODO: make '237px', which is the narrative header, less hard-coded
const height = `calc(100% - 237px - ${timelineDims.height}px)`
if (selected.length > 0) {

View File

@@ -71,6 +71,16 @@ class Dashboard extends React.Component {
)
}
filterEventDuplicates (events) {
const seen = Set()
const filteredEvents = events.filter(evt => {
if (!(seen.has(evt.id))) {
seen.add(evt.id)
return evt
}
})
}
handleSelect (selected, axis) {
const matchedEvents = []
const TIMELINE_AXIS = 0
@@ -86,8 +96,8 @@ class Dashboard extends React.Component {
ptr >= 0 &&
(events[idx].datetime).getTime() === (events[ptr].datetime).getTime()
) {
matchedEvents.push(events[ptr])
ptr -= 1
matchedEvents.push(events[ptr])
ptr -= 1
}
// check events after
ptr = idx + 1
@@ -96,14 +106,15 @@ class Dashboard extends React.Component {
ptr < events.length &&
(events[idx].datetime).getTime() === (events[ptr].datetime).getTime()
) {
matchedEvents.push(events[ptr])
ptr += 1
matchedEvents.push(events[ptr])
ptr += 1
}
} else { // Map...
const std = { ...selected }
delete std.sources
Object.values(std).forEach(ev => matchedEvents.push(ev))
}
console.info(matchedEvents)
this.props.actions.updateSelected(matchedEvents)
}

View File

@@ -20,23 +20,8 @@ function childrenToToggle (filter, activeFilters, parentOn) {
return childKeys
}
// function aggregatePaths (filters) {
// let aggregated = {}
// filters.forEach(item => {
// let currentDepth = aggregated
// item.filter_paths.forEach(path => {
// if (!(path in aggregated)) {
// currentDepth[path] = {}
// }
// currentDepth = currentDepth[path]
// })
// })
// return aggregated
// }
function aggregatePaths (filters) {
function insertPath (children = {}, [headOfPath, ...remainder]) {
console.info(children, headOfPath, remainder)
let childKey = Object.keys(children).find(key => key === headOfPath)
if (!childKey) children[headOfPath] = {}
if (remainder.length > 0) insertPath(children[headOfPath], remainder)