mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
Added cron package, update scores every minute
This commit is contained in:
parent
3fcf344d1f
commit
24846062e1
4 changed files with 25 additions and 6 deletions
|
@ -9,3 +9,4 @@ accounts-ui
|
|||
# accounts-twitter
|
||||
router
|
||||
groups
|
||||
cron
|
||||
|
|
|
@ -19,11 +19,22 @@ var Scoring = {
|
|||
|
||||
},
|
||||
|
||||
// rerun all the scoring
|
||||
// rerun all the scoring -- TODO: should we check to see if the score has
|
||||
// changed before saving?
|
||||
updateScores: function() {
|
||||
Posts.find().forEach(function(post) {
|
||||
Scoring.updateObject(post);
|
||||
Posts.update(post._id, {$set: {score: post.score}});
|
||||
});
|
||||
|
||||
Comments.find().forEach(function(comment) {
|
||||
Scoring.updateObject(comment);
|
||||
Comments.update(comment._id, {$set: {score: comment.score}});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Meteor.Cron = new Cron();
|
||||
Meteor.Cron.addJob(1, function() {
|
||||
Scoring.updateScores();
|
||||
})
|
|
@ -4,6 +4,7 @@
|
|||
},
|
||||
"packages": {
|
||||
"router": {},
|
||||
"groups": {}
|
||||
"groups": {},
|
||||
"cron": {}
|
||||
}
|
||||
}
|
||||
|
|
14
smart.lock
14
smart.lock
|
@ -2,12 +2,13 @@
|
|||
"meteor": {
|
||||
"git": "https://github.com/meteor/meteor.git",
|
||||
"branch": "auth",
|
||||
"commit": "102880a306b1ea1b967f7a9ad208d3fa30e3a268"
|
||||
"commit": "e9dcfff310c5ab2e8b968bd2b7319d3c32e3c2a1"
|
||||
},
|
||||
"dependencies": {
|
||||
"basePackages": {
|
||||
"router": {},
|
||||
"groups": {}
|
||||
"groups": {},
|
||||
"cron": {}
|
||||
},
|
||||
"packages": {
|
||||
"router": {
|
||||
|
@ -17,8 +18,13 @@
|
|||
},
|
||||
"groups": {
|
||||
"git": "https://github.com/possibilities/meteor-groups.git",
|
||||
"tag": "v0.0.5",
|
||||
"commit": "d79861fa9f31d885ffae02dd67ca6b2b725dcf13"
|
||||
"tag": "v0.0.6",
|
||||
"commit": "ee45c3fbdb84313f6f0124ed30e02e101d3829cb"
|
||||
},
|
||||
"cron": {
|
||||
"git": "https://github.com/tmeasday/meteor-cron.git",
|
||||
"tag": "v0.0.1",
|
||||
"commit": "8cecc021c1fb681bfa1de2aa8242448a4516049a"
|
||||
},
|
||||
"deps-extensions": {
|
||||
"git": "https://github.com/tmeasday/meteor-deps-extensions.git",
|
||||
|
|
Loading…
Add table
Reference in a new issue