Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jay J Kim
weather
Commits
19e18742
Commit
19e18742
authored
Aug 31, 2016
by
Zach Knox
Browse files
Wrap the data insert in a function to call it later
probably gonna need to do more with this
parent
2bdc3c5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
weather/imports/api/data.js
View file @
19e18742
...
...
@@ -3,17 +3,19 @@ import { Mongo } from 'meteor/mongo';
export
const
WeatherData
=
new
Mongo
.
Collection
(
'
weather-data
'
);
for
(
var
key
in
LOCATIONS
)
{
const
current
=
LOCATIONS
[
key
];
var
currentData
Meteor
.
call
(
'
weatherDataForLoc
'
,
current
.
lat
,
current
.
long
,
function
(
err
,
res
){
currentData
=
res
});
WeatherData
.
insert
({
name
:
current
.
name
,
lat
:
current
.
lat
,
long
:
current
.
long
,
data
:
currentData
,
lastUpdated
:
new
Date
(),
});
export
function
refreshData
()
{
for
(
var
key
in
LOCATIONS
)
{
const
current
=
LOCATIONS
[
key
];
var
currentData
Meteor
.
call
(
'
weatherDataForLoc
'
,
current
.
lat
,
current
.
long
,
function
(
err
,
res
){
currentData
=
res
});
WeatherData
.
insert
({
name
:
current
.
name
,
lat
:
current
.
lat
,
long
:
current
.
long
,
data
:
currentData
,
lastUpdated
:
new
Date
(),
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment