Skip to content

Commit

Permalink
can update airtable with geolocation
Browse files Browse the repository at this point in the history
relates to issue #18
  • Loading branch information
Armand-Lluka committed Oct 5, 2018
1 parent e2fd8db commit b924cd3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 37 deletions.
31 changes: 0 additions & 31 deletions backupshit.js

This file was deleted.

26 changes: 20 additions & 6 deletions controllers/airtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = (req, res, next) => {

}, (error, res, body) => {
if (error) {
// console.log(error)
// connsole.log(error)
next(error)
return
}
Expand All @@ -65,11 +65,25 @@ module.exports = (req, res, next) => {
lng: body.result[i].result.longitude
}
}
console.log(storage)
return storage;


// console.log(storage[0].coordinates)
for (let i = 0; i < storage.length; i++){
// console.log(storage.length)

base('fonthilldummy').update(storage[i].id, {
'geolocation': JSON.stringify(storage[i].coordinates)
}, function(err,record) {
if (err){console.log(err); return;}
console.log(record.get('geolocation'));
});


}



})

// To fetch the next page of records, call `fetchNextPage`.
// If there are more records, `page` will get called again.
// If there are no more records, `done` will get called.
Expand All @@ -80,7 +94,7 @@ module.exports = (req, res, next) => {

function done(err) {
if (err) { console.error(err); next(err); }
res.send({ ...storage })
res.send({...storage})

});

Expand Down

0 comments on commit b924cd3

Please sign in to comment.