<commit_before>//var postId = Router.current().params._id,
//	posts = Posts.find().fetch();
//
//console.log(postId);

//for(var i = 0; i < posts.length; ++i) {
//	if (posts[i]._id === postId) {
//		var current = posts[i],
//			index = posts.indexOf(current);
//
//		index++;
//
//		var nextPost = Posts.findOne(posts[index]._id);
//
//		//if (index === posts.length) {
//		//	e.preventDefault();
//		//} else {
//		//	var nextPost = Posts.findOne(posts[index]._id);
//		//}
//	} else {
//		e.preventDefault();
//	}
//}

Template.post.onRendered(function() {
   Meteor.subscribe('posts');
});

Template.post.helpers({
    post: function () {
        return Posts.findOne(Router.current().params._id);
    },
    next: function () {
        var current = Router.current().params._id;
        console.log(current);
        var next = Posts.find({createdAt: {$gt: current.createdAt}}, {sort: {createdAt: 1}, limit:1});
        console.log(next);
        return next;
    }
});<commit_msg>more work on next post helper - data being returned, needs sorting<commit_after>//var postId = Router.current().params._id,
//	posts = Posts.find().fetch();
//
//console.log(postId);

//for(var i = 0; i < posts.length; ++i) {
//	if (posts[i]._id === postId) {
//		var current = posts[i],
//			index = posts.indexOf(current);
//
//		index++;
//
//		var nextPost = Posts.findOne(posts[index]._id);
//
//		//if (index === posts.length) {
//		//	e.preventDefault();
//		//} else {
//		//	var nextPost = Posts.findOne(posts[index]._id);
//		//}
//	} else {
//		e.preventDefault();
//	}
//}

Template.post.onRendered(function () {
    Meteor.subscribe('posts');
});

Template.post.helpers({
    post: function () {
        return Posts.findOne(Router.current().params._id);
    },
    next: function () {
        //var current = Router.current().params._id;
        //console.log(current);
        //var next = Posts.find({createdAt: {$gt: current.createdAt}}, {sort: {createdAt: 1}, limit:1});
        //console.log(next);
        //return next;

        var postId = Router.current().params._id,
            posts = Posts.find().fetch();

        console.log(postId);

        for (var i = 0; i < posts.length; ++i) {
            if (posts[i]._id === postId) {
                var current = posts[i],
                    index = posts.indexOf(current);

                index++;

                var nextPost = Posts.findOne(posts[index]._id);
                return nextPost;

                //if (index === posts.length) {
                //	e.preventDefault();
                //} else {
                //	var nextPost = Posts.findOne(posts[index]._id);
                //}
            } else {
                e.preventDefault();
            }
        }
    }
});
{'fraction_non_alphanumeric': 0.204, 'fraction_numerical': 0.0025454545454545456, 'mean_word_length': 1.9644396551724137, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4923656', 'n_tokens_mistral': 948, 'n_tokens_neox': 915, 'n_words': 165}