Cleanup cloud functions

I think I see what you're saying. Yea lets try it out. Should be easy to test.

> On Jul 29, 2014, at 10:06 AM, Jose Montes de Oca <notifications@github.com> wrote:
> 
> In cloud/main.js:
> 
> > -    var internalResponse = {};
> > -    getUser(request.params.userId).then(function(user) {
> > -        request.user = user;
> > -        return stackedBarChart(request, internalResponse);
> > +/**
> > + * Helpers for populating the goal views
> > + */
> > +
> > +getPostsForGoal = function(goalId, internalResponse) {
> > +    internalResponse = internalResponse || {};
> > +    // fetch posts related to the goals
> > +    var query = new Parse.Query('Post');
> > +    query.equalTo('goal', createGoalWithId(goalId));
> > +    query.descending('createdAt');
> > +    // XXX i don't think this will actually include the comment
> > +    query.include('comment');
> @mhahn We can do that or have the post have a list of comments (This is fine for our prototype as we are unlikely to have > 100 comments per post). After reading the docs, that's how the include will bring those entities.
> 
> I am just hoping to use the include and not make you do yet another query. We should let parse handle the dependent objects pulling while querying the posts.
> 
> Thoughts ?
> 
> —
> Reply to this email directly or view it on GitHub.