Commit 19e18742 authored by Zach Knox's avatar Zach Knox

Wrap the data insert in a function to call it later

probably gonna need to do more with this
parent 2bdc3c5f
...@@ -3,17 +3,19 @@ import { Mongo } from 'meteor/mongo'; ...@@ -3,17 +3,19 @@ import { Mongo } from 'meteor/mongo';
export const WeatherData = new Mongo.Collection('weather-data'); export const WeatherData = new Mongo.Collection('weather-data');
for(var key in LOCATIONS) { export function refreshData() {
const current = LOCATIONS[key]; for(var key in LOCATIONS) {
var currentData const current = LOCATIONS[key];
Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){ var currentData
currentData = res Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){
}); currentData = res
WeatherData.insert ({ });
name: current.name, WeatherData.insert ({
lat: current.lat, name: current.name,
long: current.long, lat: current.lat,
data: currentData, long: current.long,
lastUpdated: new Date(), data: currentData,
}); lastUpdated: new Date(),
});
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment