add function to get latest, complete entry
This commit is contained in:
parent
31667a0d9f
commit
3da44b14eb
15
index.html
15
index.html
@ -143,7 +143,20 @@
|
|||||||
map.setView(selectedCoords, 13)
|
map.setView(selectedCoords, 13)
|
||||||
})
|
})
|
||||||
|
|
||||||
var theLatestSpot = gData.reverse()[0]
|
// so that the first map and info that loads
|
||||||
|
// is complete and doesn't show rows that are
|
||||||
|
// actively being edited by folk
|
||||||
|
function findLatestCompleteSpot(data) {
|
||||||
|
var latestCompleteSpot = []
|
||||||
|
var startWithLatestRow = data.reverse()
|
||||||
|
startWithLatestRow.forEach(function(row){
|
||||||
|
if (!row.lat || !row.long || !row.name || !row.address || !row.city || !row.state ) return
|
||||||
|
else latestCompleteSpot.push(row)
|
||||||
|
})
|
||||||
|
return latestCompleteSpot[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
var theLatestSpot = findLatestCompleteSpot(gData)
|
||||||
var latestSpot = ich.latestSpot({
|
var latestSpot = ich.latestSpot({
|
||||||
rows: theLatestSpot
|
rows: theLatestSpot
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user