working on bug

This commit is contained in:
Sacha Greif 2012-11-02 13:16:24 +09:00
parent bd1960e7fe
commit 7a92ebbc15
2 changed files with 12 additions and 12 deletions

View file

@ -75,7 +75,7 @@ TOP_PAGE_PER_PAGE = 10;
TOP_PAGE_SORT = {score: -1}; TOP_PAGE_SORT = {score: -1};
Session.set('topPageLimit', TOP_PAGE_PER_PAGE); Session.set('topPageLimit', TOP_PAGE_PER_PAGE);
Meteor.autosubscribe(function() { Meteor.autosubscribe(function() {
Session.get('topPostsReady', false); Session.set('topPostsReady', false);
Meteor.subscribe('posts', FIND_APPROVED, { Meteor.subscribe('posts', FIND_APPROVED, {
sort: TOP_PAGE_SORT, sort: TOP_PAGE_SORT,
limit: Session.get('topPageLimit') limit: Session.get('topPageLimit')
@ -93,7 +93,7 @@ NEW_PAGE_PER_PAGE = 10;
NEW_PAGE_SORT = {submitted: -1}; NEW_PAGE_SORT = {submitted: -1};
Session.set('newPageLimit', NEW_PAGE_PER_PAGE); Session.set('newPageLimit', NEW_PAGE_PER_PAGE);
Meteor.autosubscribe(function() { Meteor.autosubscribe(function() {
Session.get('newPostsReady', false); Session.set('newPostsReady', false);
// note: should use FIND_APPROVED, but this is a temporary workaround because of bug // note: should use FIND_APPROVED, but this is a temporary workaround because of bug
Meteor.subscribe('posts', {userId:{$exists: true},$or: [{status: {$exists : false}}, {status: STATUS_APPROVED}]}, { Meteor.subscribe('posts', {userId:{$exists: true},$or: [{status: {$exists : false}}, {status: STATUS_APPROVED}]}, {
sort: NEW_PAGE_SORT, sort: NEW_PAGE_SORT,
@ -111,7 +111,7 @@ PENDING_FIND = {$or: [{status: STATUS_PENDING}, {status: STATUS_REJECTED}]};
// PENDING_FIND = {}; // PENDING_FIND = {};
// PENDING page // PENDING page
Meteor.autosubscribe(function() { Meteor.autosubscribe(function() {
Session.get('pendingPostsReady', false); Session.set('pendingPostsReady', false);
Meteor.subscribe('posts', PENDING_FIND, { Meteor.subscribe('posts', PENDING_FIND, {
sort: NEW_PAGE_SORT, sort: NEW_PAGE_SORT,
limit: Session.get('newPageLimit') limit: Session.get('newPageLimit')
@ -140,7 +140,7 @@ var digestPageFind = function(mDate) {
Session.set('digestPageLimit', DIGEST_PAGE_PER_PAGE); Session.set('digestPageLimit', DIGEST_PAGE_PER_PAGE);
Meteor.autosubscribe(function() { Meteor.autosubscribe(function() {
Session.get('digestPostsReady', false); Session.set('digestPostsReady', false);
var mDate = moment(sessionGetObject('currentDate')); var mDate = moment(sessionGetObject('currentDate'));
// start yesterday, and subscribe to 3 days // start yesterday, and subscribe to 3 days

View file

@ -58,15 +58,15 @@ Meteor.publish('posts', function(find, options) {
var collection=Posts.find(find, options); var collection=Posts.find(find, options);
var collectionArray=collection.fetch(); var collectionArray=collection.fetch();
// console.log("publishing…"); console.log("publishing…");
// console.log(find, options.sort, options.skip, options.limit); console.log(find, options.sort, options.skip, options.limit);
// console.log('collection.count() '+collection.count()); console.log('collection.count() '+collection.count());
// console.log('collection.fetch().length '+collectionArray.length); console.log('collection.fetch().length '+collectionArray.length);
// for(i=0;i<collectionArray.length;i++){ for(i=0;i<collectionArray.length;i++){
// console.log('- '+collectionArray[i].headline); console.log('- '+collectionArray[i].headline);
// } }
// console.log('\n'); console.log('\n');
return collection; return collection;
}); });